Mapping table-value parameters#845
Conversation
ca597d2 to
41b8255
Compare
|
Really nice work dude! |
|
This work was done a while ago and would really make some of work i'm currently doing easier. Could this be merged in and released? |
|
@Jetski5822 thank you! ✋ |
|
@adnang I thought to publish it as a separate package, because it's working successfully in a high-load project for more than 1 year. But unfortunately OCP principle wasn't a part of Dapper's vision so I had to use some internals and such package will be hacky. |
|
I could really use this feature in my current project. Any update on if/when it would be released? |
|
|
||
| #if !NETSTANDARD1_3 | ||
| var exists = typeProperties.Any(item => item.MetadataToken == property.MetadataToken); | ||
| exists = typeProperties.Any(item => item.MetadataToken == property.MetadataToken); |
There was a problem hiding this comment.
This line looks to be redundant.
|
@StanEgo We dropped the ball responding here, not returning to it after By necessity of referencing types, it needs to be a separate package, but I am curious what internals you'd need to make that possible. I'm not quite sure how you'd gracefully handle both SQL clients (it's a bit of a mess, in some situations, so depends how deep you get). It seems like you went down the separate package route at least somewhat, any chance you still remember what else would need to be exposed to make this work cleanly that way? |
|
@NickCraver, unfortunately it's not in my cache right now. But I glanced at the projects it is used in and can say that it easily migrated to Microsoft.Data.SqlClient (only usings changed from System.Data.SqlClient/Microsoft.SqlServer.Server to Microsoft.Data.SqlClient/Microsoft.Data.SqlClient.Server). It also works with the most actual Dapper 2.0.90 without any hacks (except using LookupDbType method marked as obsolete and commented as for internal usage only, but still public). Completely agreed that having it in a separate MSSQL-related package, keeping Dapper core based on the abstractions is a good idea. Maybe it would be better also to implement another extensibility point for type providers (like it is done for mappings and even some poor-man solution for bulk copy providers). So things like Line 409 in 29f3bef |
Dapper is know as an object mapper tool, but when we deal with TVPs (table-value params) ther is a lack of mapping. Currently only DataTable and SqlDataRecord[] are supported which are a huge distance away from POCO. In ORM worls such tables are represented as IEnumerable.
In my ongoing project I have implemented a quickfix for this and decided to share idea with you. Some notes:
Probably this will address #541, #201, #807, #389.