DapperDotNet w/IronPython: How To Handle Returned Result Set?
-
06-07-2021 - |
Вопрос
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!