Wednesday, January 22, 2020

Entity Framework and Dapper together?

I think it is alright to have a mix of Entity Framework and stored procedures, but as suggested here you do not want to have stored procedures hydrating things in Entity Framework and instead of using ADO.NET maybe you could just use Dapper side-by-side with Entity Framework for the sprocs to alleviate the ghettoness of righthand/lefthand mappings to POCOs from datasets. While I am giving my thoughts, I realize that if you do want to use sprocs with Entity Framework that it would be nice to go all the way and not have some of the sprocs mapped in in another way. One pain point with this is that if there is not a unique ID for each record, as there will not be with sprocs using GROUP BY to aggregate data in "reporting" and such, you can't use EF. Maybe, if you have control of the sproc, you could jam in an extra column returned to make a pseudoid.

No comments:

Post a Comment