Dapper: Support AsTableValuedParameter(IEnumerable<SqlDataRecord>) on Core

Created on 9 Sep 2016  路  5Comments  路  Source: StackExchange/Dapper

Core currently supports SqlDataRecord. So, please support the IEnumerable<SqlDataRecord> overload of AsTableValuedParameter on Core.

Thank you

Most helpful comment

1.50.4 which restores all these bits for netstandard2.0 is now on NuGet: https://www.nuget.org/packages/Dapper/1.50.4

Sorry for the long delay, we had to wait on the underlying bits to be ready and then find the time on our side as well. If you find any issues please let us know!

All 5 comments

I agree! Please support IEnumerable<SqlDataRecord>. DataTable is no longer implemented in Core. Although the Table Value Parameter is native to MS SQL and not ideal for large sets, it is perfect to pass few multiple values. Much easier than string or varbinary parsing! Thank you!

Sigh, I was trying it yesterday and asked for help on stackoverflow... http://stackoverflow.com/questions/41132350/is-there-a-way-to-pass-a-tvp-to-dapper-on-net-core-right-now So any knows if there is a way? or at least a plan for it?

Update: I think I made it by wrapping the SqlParameter in a generic class that accepts the SqlParameter and implements IDynamicParameters. Now I am getting the error that my Type doesn't exists on the database, I will try to create my Table type this evening at home (now I'm working :p)

With more time I made it work, can be improved but at least works for these who want to start from there.

We use TVPs very heavily where I work. We recently upgraded a project to all netstandard 1.6 and of course the dependency of DataTable broke and we couldn't use the extension method AsTableValuedParameter.

Once I have some bandwidth, I'll take the time make a PR to at least have an example in the Tests for netstandard to show how to do use TVP's.

But for anyone else trying to figure this out, I created a quick gist to show it's done: Dapper TVP Example w/ SqlDataRecord

1.50.4 which restores all these bits for netstandard2.0 is now on NuGet: https://www.nuget.org/packages/Dapper/1.50.4

Sorry for the long delay, we had to wait on the underlying bits to be ready and then find the time on our side as well. If you find any issues please let us know!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafakwolf picture rafakwolf  路  5Comments

fishjimi picture fishjimi  路  5Comments

silkfire picture silkfire  路  4Comments

huobazi picture huobazi  路  4Comments

ishamfazal picture ishamfazal  路  5Comments