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.
- 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. - nHibernate supports all types of databases but Entity framework need additional connectors to support databases other than MSSQL.
- nHibernate can be extended in terms of data loading, SQL generation, custom column types, custom collections etc but entity framework has limited extension points.
- nHibernate supports lazy loading for scalar properties like BLOB, CLOB but entity framework not.
- Support for Extended cascading deletion of rows.
- More events included like preload, postload, updation, deletion.
- Support for second level cache.
- Multiple queries can be fired in one round trip but it is not possible in entity framework.
- nHibernate has larger start up time than
entity framework because of metadata preparation.

james leePosted Jul 30, 2012, 2:58 AM
Short and briefed, Thanks for sharing it. As far as caching features is concerned, there are some third party tools which offer it’s support for both NHibernate and Entity Framework to work as L2 cache. NCache is one fine example of it. You can read more about it from, http://www.alachisoft.com/ncache/nhibernate-l2cache-index.html