NHibernate Features Not in Entity Framework 4 ( EF4 )

I have used NHibernate and Entity Framework for several different projects in the past. There are advantages and disadvantages to using either ORM tool. NHibernate is more mature and has many more data access patterns built in to support more advanced scenarios.

List of NHibernate features missing in EF 4:

  • Enum support out of the box
  • Convention based mappings for doing things like trimming strings automatically ( Can be done using entity framework extensions with EF4 but it's a hack)
  • Using mutable="false" in your NHibernate mapping file you can make an entity readonly
    NHibernate can fetch multiple distinct items in one database hit using the "Futures" api
  • NHibernate has a 2nd level cache built in with multiple providers available
  • EF4 has no equivalent to the Criteria Api available in NHibernate ( try to make a dynamic query using Linq and you'll see why this feature is nice )
  • Batching support is provided without custom tooling in NHibernate.