Question

I've got a store procedure call returning a recordset whith field unknown in advance. For some interop reason I need to make it working on 3.5, so I don't have any dynamic support. Is there some built-in solution in dapper? I did not find any by myself. If there is no such a solution, does it make sense ( and does it work ) to create on the fly a type exposing the property I would fetch ? EDIT I managed to add a completely external solution ( without tweaking the original codebase ) by creating a dynamic object in c# 3.0. Here is the extension dapper code and here the factory for the dynamic object.

Was it helpful?

Solution

Well, actually the dynamic support in dapper is implemented via ExpandoObject, which is basically just a dictionary. It would be pretty simple to tweak the existing code to return IDictionary<string,object> instead of dynamic in the case of 3.5

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top