Tried to throw a quick example together this morning but I ran into a road block. Everything works fine up to the point when I want to do something with the result set returned. Dapper is returning a result set of System.Collections.Generic.List'1 back. Can IronPython handle consuming generic collections of expando objects?

The gist of related code is here: https://gist.github.com/3873014

Edit: Ok, I've finally noticed I never told the Query extension a type. Working on that now...

有帮助吗?

解决方案

After giving the Query extension a type, I was able get this working. To test this out, I ended up just returning the results as a simple System.Object:

data = cn.Query[object](procName, params,commandType=CommandType.StoredProcedure)[0]

Converted to type to a dictionary: customer = clr.Convert(data, IDictionary[System.String, System.Object])

And was able to get what I needed from there. So,...

>>>print customer.CustomerID

...returns 'ALKFI'. Programmer error FTW!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top