Dapper or ADO.NET when faced with tables with no primary key constraints

ado.net asp.net asp.net-mvc c# dapper

Question

In reference to this post

Using ASP.Net MVC with Classic ADO.Net

I wanted a bit of help regarding building an MVC application using a database that I have no access to change, which has tables with no primary keys and some with no discernable unique combination of fields to use as a composite key.

I only have some basic experience with Entity Framework and ADO.NET.. and so I felt that example post was a good way to go.

I am also interested in whether http://code.google.com/p/dapper-dot-net/ could also achieve what I want to do and whether it is worth spending the time then learning that over writing the data access myself? considering I am not greatly experienced in either.

Any help on this would be great. Thanks

Accepted Answer

One major benefit of dapper over rolling your own data access is in the mapping of data to POCO's which greatly simplifies converting your query to a domain object. We have recently moved from a full ORM (NHibernate) to dapper and have found the benefits of automapping from dapper and the ability to handle our own querying works really well.

It will come down to what suits you and your team best but learning dapper can only add another usefull tool to your toolbox.

Also, if you are comfortable with ado.net dapper really isn't much of a mental jump.

As far as the poor design of the database you can't change is concerned that will always be your bottleneck regardless of how you access it, there really is not a substitute for a primary key as a minimum requirement from a datastore but dapper should make your life as s developer more comfortable!



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow