nHibernate vs Entity Framework

Entity Framework vs. nHibernate

ADO.Net Entity framework and nHibernate are object relational mapping frameworks. These can be used to map database schema to domain objects in any object oriented language. Entity framework is a Microsoft technology introduced in .net 3.5 service pack1. It is always easy and good to include business logic in application code. Therefore, these tools are very helpful to map database data in your persistence layer of application code without the need of writing data access code. There are some differences and advantages using nHibernate over Entity framework which is listed below.

  1. Entity framework are not POCO classes, they also contains some lower level functionality along with business properties to work with database
    but nHibernate works with pure POCO classes.
  2. nHibernate supports all types of databases but Entity framework need additional connectors to support databases other than MSSQL.
  3. nHibernate can be extended in terms of data loading, SQL generation, custom column types, custom collections etc but entity framework has limited extension points.
  4. nHibernate supports lazy loading for scalar properties like BLOB, CLOB but entity framework not.
  5. Support for Extended cascading deletion of rows.
  6. More events included like preload, postload, updation, deletion.
  7. Support for second level cache.
  8. Multiple queries can be fired in one round trip but it is not possible in entity framework.
  9. nHibernate has larger start up time than entity framework because of metadata preparation.