Tomboi88 / dapper-dot-net

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

Accept dynamic as a Parameter #99

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here's one (but there are others) use-case. Moving data from source A to target 
B.

var source = connA.Query("select * from TA", buffered: false);
connB.Execute("insert into TB values (@Id, @SomeMore)", source);

Doesn't work. I have looked into the problem and the culprit seems to be that 
SqlMapper.CreateParamInfoGenerator doesn't support a dynamic object as 
parameter source.

Because the same code is used inside DynamicParameters, there's really no way 
to easily pass a dynamic object to Dapper as parameters, which is a shame given 
that Dapper itself outputs dynamic objects ;)

Original issue reported on code.google.com by joel.du...@gmail.com on 7 Jun 2012 at 5:38

GoogleCodeExporter commented 8 years ago
Fixed for ExpandoObject and other similar, although note that not *all* dynamic 
allow this, since their available properties aren't necessarily queryable

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

GoogleCodeExporter commented 8 years ago
Great, thanks! I'll test that tomorrow.
It's going to make data migration so much easier...

Original comment by joel.du...@gmail.com on 25 Jun 2012 at 6:51