quaiton89 / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

Dynamic parameters and overload resolution #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I see the remarks about the odd dynamic parameters to work around VS 
completion, but in trying to customize the library for my own use (see issue 
#80 http://code.google.com/p/dapper-dot-net/issues/detail?id=80)  I was having 
problems with the dynamic typed parameters because they cause runtime overload 
resolution instead of compile time resolution.

See the relevant MSDN here: 
http://msdn.microsoft.com/en-us/library/dd264736.aspx

> Overload resolution occurs at run time instead of at compile time if 
> one or more of the arguments in a method call have the type dynamic, 
> or if the receiver of the method call is of type dynamic.

Seems like this may pose a performance or other issue and not be desirable.  I 
understand the frustrations with anonymous types in VS and the autocompletion, 
its very annoying, but is it worth runtime overload resolution?

Original issue reported on code.google.com by p...@paultyng.net on 19 Jan 2012 at 9:29

GoogleCodeExporter commented 8 years ago
Can you add a broken test case? Or sample where the current dynamic stuff is 
causing an issue? 

Original comment by sam.saff...@gmail.com on 22 Jan 2012 at 11:34

GoogleCodeExporter commented 8 years ago
@Sam just:

dynamic obj = new ExpandoObject();
conn.Query<string>(@"...", obj);

is enough... thoughts?

Original comment by marc.gravell on 25 Jun 2012 at 3:47