Why should I use nhibernate instead of entity framework 4

I'm trying to convince my client to use nhibernate instead of Entity Framework 4. My client have decided to use only Microsoft libraries (including Unity and Enterprise library 5). I don't agree with them (there are so much better logging frameworks/validation layers/ioc etc) but respect their decision.

I've played with EF4 for a couple of days and I do not like it, mainly because of:

  • First of all, all error messages are horrible. I have to spend more time googling what the exceptions actually means than to try fix them.

  • We use POCO's and it was a bit of a hassle to make them work OK with EF4.

  • The mappings files used by nhibernate is so much easier to work with.

  • Do anyone else have experience with both frameworks and give me more reasons to why they should not use ef4?

    Are there any GUI tools or visual studio addins which can be used to generate mapping files / models from a database (stuff like that always helps)


    People have blogged long and in depth responses that can do much better than a few sentances here on this forum. Take a look at the following or do a Google search for "NHibernate vs. Entity Framework 4.0":

    A Quest With EF 4.0 (Entity Framework) And NHibernate Part 1:
    http://blogs.microsoft.co.il/blogs/berniea/archive/2009/06/09/a-quest-with-ef-4-0-entity-framework-and-nhibernate-part-1.aspx
    http://blogs.microsoft.co.il/blogs/berniea/archive/2009/06/09/a-quest-with-ef-4-0-entity-framework-and-nhibernate-part-2.aspx

    NHibernate vs. Entity Framework 4.0:
    http://ayende.com/Blog/archive/2010/01/05/nhibernate-vs.-entity-framework-4.0.aspx

    Entity Framework 4 vs NHibernate

    链接地址: http://www.djcxy.com/p/60270.html

    上一篇: 从NHibernate迁移到实体框架6

    下一篇: 为什么我应该使用nhibernate而不是实体框架4