I have had some progress with sending Table Valued Parameters to a stored procedure using Dapper I used the modified Mapper.cs file here -
http://code.google.com/p/dapper-dot-net/issues/detail?id=117
My code works just fine. My question is -
1) If the official Dapper file will incorporate a change like this to support Table Valued Parameters
2) How often does Dapper change/evolve to incorporate new SQL Server features. I understand it being Open source I will get solutions to incorporate the changes myself. But does the community leadership target a particular timeframe to accomodate new changes in the official Dapper file?
Comment #1
Posted on Jun 2, 2014 by Massive BearThis is not exactly a "new" database feature in terms of dapper. When we looked at this first, there were some issues in terms of metadata, in particular specifying the table-type, but it is perhaps long overdue time to revisit this.
Comment #2
Posted on Jun 2, 2014 by Swift GiraffeHey marc.gravell,
So can we look forward to Dapper source changing to accomodate TVP?
Comment #3
Posted on Jun 2, 2014 by Massive BearI've pushed code (not NuGet) with a .AsTableValuedParameter() extension method on data-tables; this is necessary to allow the same level of support for both command-text and sproc code, since a type-name is required for command-text. Thoughts?
Comment #4
Posted on Jun 2, 2014 by Swift GiraffeI'm really sorry I am not well versed with the code in SqlMapper. Is this similar to the change in the file attached? If so it works perfectly fine her.
Also I would need a NuGet release to justify use in production got a few haters here :(
- SqlMapperWithTVPSupport.cs 127.18KB
Comment #5
Posted on Jun 2, 2014 by Massive BearI'm guessing you're using stored procedures, right? As far as I can see, it cannot work fine, except for stored procedures.
Comment #6
Posted on Jun 3, 2014 by Swift GiraffeOh yes I havent mentioned that? I'm so sorry...I am doing an insert using a stored procedure...which needs a TVP...which I pass using a data table. This functionality works using the file I attached. I was however hoping that the official NuGet dll also gets a change.
Comment #7
Posted on Jun 3, 2014 by Massive Bearindeed. I'm happy to look further at making it work more easily for sprocs (the change is actually to do less, and is not huge) - but if we have inbuilt TVP support I want it to work for command-text too. About to fly to NDC Oslo. Will look again upon return.
Comment #8
Posted on Jun 3, 2014 by Swift GiraffeThats great. Thank you so much.
Comment #9
Posted on Jul 10, 2014 by Swift GiraffeHi Marc,
I was wondering if there has been any progress in integrating TVP support in Dapper. A follow up to this conversation we had.
Comment #10
Posted on Jul 10, 2014 by Massive BearYes; lots. http://stackoverflow.com/a/24633764/23354
That do? I'm going to mark this complete.
Comment #11
Posted on Jul 10, 2014 by Swift Giraffeoh thats great! Is the updated dll available on NuGet? Or should I pull from GitHub?
Comment #12
Posted on Jul 10, 2014 by Massive BearYes, that build is (I'm 99.99% sure) available on NuGet; see also:
http://blog.marcgravell.com/2014/07/dapper-gets-type-handlers-and-learns.html http://blog.marcgravell.com/2014/06/dapper-some-minor-but-useful-tweaks.html
Comment #13
Posted on Jul 10, 2014 by Swift GiraffeGreat! Thanks a lot Marc. Dapper is truly amazing thanks to you guys
Status: Fixed
Labels:
Type-Defect
Priority-Medium