Which ORM should I use for an ASP.Net MVC project?

I am starting a new ASP.Net MVC project and wondering which approach is best for the model.

Most demos recommend LinqToSQL, but I know that Microsoft does not actually improve this product and focuses more on the Entity Framework.

I like the Subsonic approach, but I thought it would be built with MVC with version 3, but there was no news about the development stage of this project, so I am a little afraid to use version 2 if there is a new release soon.

I heard about NHibernate and Castle Record, but they had no experience and they heard a lot of pros and cons for both.

Any help would be highly recommended!

+7
asp.net-mvc orm
source share
9 answers

For SubSonic, Rob will just release a new MVC template that you can use when starting a new project that bakes a lot of good stuff into a new MVC project, including the preview release of SubSonic 3. Detais are available on Rob Conery's blog .

+6
source share

nThe original learning curve is higher, but worth it. Use Fluent nHibernate to relieve pain a bit. nHibernate is less obvious than some ORMs, but this is really only a problem when you start, and as soon as you have experience with it, the lack of a visual designer is a useful IMO.

+11
source share

LLBLGenPro works great for me. This is the best .net ORM. I would avoid Linq to Sql, because you will have problems when the project grows and is rather weak in functions (in addition to obvious shortcomings, for example, it only works with SQL Server, etc.)

+4
source share

I use linq2sql and I think it works fine if you use MSSQL as your database (it also works with other databases, but it requires third-party tools). Yes, Microsoft has β€œstopped” development, but is mature enough for an average project. I doubt that you will encounter any walls. If you are starting a large project that you need to support for years to come, the Entity Framework might be more appropriate.

I personally have not used NHibernate and Subsonic before, but as Craig says, the NHibernate learning curve is a little steeper, although it should be a great base (everything I heard or read).

+2
source share

If you are willing to spend some money or have a smaller project, I would at least try LightSpeed . I have found pain points with very ORM that I have ever tried, and currently I'm using LINQ to SQL.

LightSpeed ​​is quite rich, although LINQ support lacks some features that cannot be handled. This is pretty close to LINQ to SQL and LINQ to Entities, but has a few more features, such as full-text search.

+2
source share

ActiveRecord works great for small to medium sized MVC projects - I use it in several projects at the moment and find it very well suited for ASP.NET MVC.

This is an implementation of an active template that uses NHibernate under the hood - in other words, if you are happy, one class for each database table, it will do most of the NHibernate configuration for you, leaving you free to write code, for example:

Customer bob = Customer.Find(/* customer Id goes here */); bob.FirstName = "Robert"; bob.Save(); Invoice newInvoice = new Invoice(); newInvoice.Products.Add(Product.Find(/* product ID goes here */); bob.Invoices.Add(newInvoice); bob.Save(); 

with very little explicit NHibernate configuration (assuming, of course, that you have customer, invoice, and product tables in your database)

Since this is NHibernate under the hood, switching to NHibernate should be simple if you need to - you will already have all the necessary links and libraries. There are several aspects of NHibernate behavior that you cannot ignore (for example, sessions and cleaning sessions ) - but it is not too difficult to develop what happens to them, and using them in ActiveRecord will give you a start if / when you need to go directly to NHibernate .

+1
source share

We use Fluent + NHibernate here, it works very well. Some alternatives that are clearly visible are SubSonic, Entity Framework, and Linq to SQL. I think the direct NHibernate is a little more cumbersome than it's worth, but it is a great base layer with Castle ActiveRecord and with Fluent.

+1
source share

I worked with a product called netTiers ( http://www.nettiers.com/ ) in the project and worked very well. This is a CodeSmith script that generates business objects from your database tables, views, and stored procedures.

0
source share

If this is not a huge project, I would use Linq To SQL. If you need all the bells and whistles, get together on nHibernate and get it from him. I do not think that you are facing serious problems anyway.

0
source share

All Articles