List of ORM libraries available for .NET and the best one

An Object Relation Mapping(ORM) library helps developers to create data access applications by programming against a conceptual model instead of programming against a relational database model.  ORMs bring lot of advantages and few of the prominent ones are -  RDBMS independent data access layer development, rapid application development, huge reduction in code, auto generation of boilerplate methods for CRUD operations and abstract access to data. More details on advantages can are nice presented in this article.

With all these advantages of ORM libraries, it’s very unlikely that a new data application development would start without using an ORM. Lets us look at the popular ORM libraries for Microsoft.NET

.NET ORM Libraries

Microsoft Entity Framework

Entity Framework is one of the most advanced and feature rich ORM library from Microsoft.  Using the Entity Framework, developers can write data access code using the popular LINQ queries to retrieve and manipulate data as strongly typed objects. The Entity Framework’s ORM supports change tracking, identity resolution, lazy loading and query translation so that developers can focus on building their application specific business logic rather than wring thousands of lines of code for fundamental data access.

The Entity Framework is built on top of  ADO.NET provider model and it integrates very well with Visual Studio. It supports Domain model and Code First model and have providers for various databases like Sql Server, SQL Azure, Oracle, MySql and DB2.

NHibernate

NHibernate is the .NET sibling of popular Java ORM framework Hibernate. If you are looking for an ORM library outside of Microsoft provided libraries, NHibernate is the most probable candidate you would end up choosing. NHibernate  is a mature, open source ORM framework which is actively developed, fully featured, highly performant and successfully used in thousands of projects.

This framework is being developed for over a decade by community members and used in thousands of commercial and open source applications. NHibernate uses XML description of entities and relationships, automatically generates SQL for retrieving and manipulating data. Optionally you can describe mappings metadata with attributes in source code.

Telerick OpenAccess

OpenAccess from Telerick, the rich user interface components development organization, is a paid ORM library for .NET. It generates the data access layer for your application with just few mouse clicks. OpenAccess has built-in support for more than 12 databases, including SQL Server, Oracle and MySQL. You can map classes to Views, Tables, and Stored Procedures.

You need to pay around $400 for this library and for that you get 24×5 support from Telerick with a guarantee of email responses in 24 hours time.

Microsoft LINQ to SQL

LINQ to SQL is another Microsoft ORM library which was released before Entity Framework. Before shipping Entity Framework, Microsoft heavily promoted Linq To Sql and it is used in many .NET applications. The LINQ to SQL provider allows LINQ to query SQL Server databases to retrieve and manipulate data as strongly typed objects. Basically it’s a semi-ORM which is meant for Sql Server and if you are looking for building generic data access code that works on any database, then Linq to Sql is not the choice for you.

Others

There are few other less known libraries available and used in few projects – AutoMapper, EntitySpaces.NET, LightSpeed, LLBLGen Pro, etc. For a comprehensive list of .NET ORM libraries check this wikipedia page.

Which one is the best?

This is a tough question to answer as it highly depends on the projects to say which ORM is best for a .NET project. There are various factors we need to consider before nailing down on the ORM – availability of developer pool with a specific ORM knowledge, size, performance & scalability requirements of the target application, level of support required and  time to market factors.

In the list of available ORM libraries Microsoft Entity Framework & NHibernate stands out in the crowd. If you organization is a fan or open source community and looking for a well oiled and proven library then you should consider NHibernate.

On the other side, Microsoft is heavily investing in developing Entity Framework and in the past couple of years 5 iterations has been released.  It’s one of the most actively developed and well optimized ORM library that plays well any of the .NET technologies. The future for Entity Framework looks very promising as the big boss Microsoft is driving it. There is a good developer community available in the market with Entity Framework skills.

We have provided you the data points and based on your requirements choose between Entity Framework or NHibernate.

Resource

  1. What is Entity Framework – MSDN
  2. Code First Development With Entity Framework – by Scott Gu
  3. Julie Lerman’s Blog on Entity Framework
  4. NHibernate
  5. Telerick OpenAccess ORM
  6. Getting Started with Linq To SQL 
  7. Object-Relational Mappings – An interview with Anders Hejlsberg
  8. Using LINQ to SQL – by Scott Gu

1 thought on “List of ORM libraries available for .NET and the best one”

Leave a Comment

Your email address will not be published. Required fields are marked *