Reputation: 2352
What's the recommended way of creating a Data Access layer in real-life ASP.NET MVC applications? Is it EF? Ef Code First? NHibernate? Any other idea?
Thank you & regards
Upvotes: 2
Views: 1211
Reputation: 5989
It all depends of your need:
NHibernate is a more mature ORM with a big community
Entity Framework is now getting very well supported and you can find also great information (check Julie Lerman blog)
Both support code generation from database.
Code first: allows you to create your database schema from your domain models. This is great if you don't want to bother with database. NHibernate can do it also.
To help you decide which way to use Entity Framework
There are many other great ORM:
Stackoverflow's ORM Dapper if performance is an important criteria there is a small benchmark on the site
Upvotes: 3
Reputation: 60448
There is no recommend way.
I prefer EF Code First for doing this because
Upvotes: 4
Reputation: 34238
The MVC gurus (the people who wrote MVC) at MS all seem to use Entity Framework at the moment. having said that you can use any ORM (or really any data access tech you want) as MVC doesnt actually specify anything at all about the way you access data
Upvotes: 0
Reputation: 44288
There is none, stackoverflow is full of people who have gone down the various routes, so you can get help no matter which choice you make.
Best advice, try doing a few small exploratory webs using a couple of approaches which seem to stand out.
Upvotes: 1
Reputation: 82267
I like to use Model First because it allows me the most freedom to design and implement in my opinion. It also makes it very easy to change the database design.
Upvotes: 1
Reputation: 5398
If you're partial to the MSFT tooling and wanting to be "modern", then EF Code First is probably the place to start. One example worth perusing: https://github.com/NuGet/NuGetGallery .
Upvotes: 1