ADO.NET Entity Framework: Decision Making between ORM solutions

前端 未结 1 1319
隐瞒了意图╮
隐瞒了意图╮ 2020-12-31 10:31

I am looking for some guideline for my new application while choosing ORM. I want to evaluate EF over NHibernate and LINQ to SQL. I need some expert voice from this wonderfu

相关标签:
1条回答
  • 2020-12-31 11:11

    Well, of the three you've listed, NHibernate has been around the longest. If you want to work with something which has a proven track record, that's probably a safe place to begin.

    It is pretty even across the four metrics (scale/learning curve/ease of use and performance) although you might find there is more information available due to it being around longer than the other two.

    LINQ to SQL has been released longer than the Entity Framework, but only runs against SQL Server flavours. It works very well as a fit-for-purpose ORM, but is not a feature-rich as the Entity Framework (which provides eSql amongst other things).

    LINQ to SQL is pretty easy to grasp (depending on your knowledge of LINQ) and more recently the quality of the generated queries has improved (since the earlier betas). I'm not sure how well it scales, or performs, but you'd have to think it's on par with an average developer's handwritten T-SQL (okay now that's a wild assumption!). It's pretty straightforward, and generates a very nice model for you within Visual Studio.

    There are other (2) alternatives for non-SQL Server databases support

    The Entity Framework is the newest of the three and as a result, still has some issues to be corrected (hopefully in the next version). It will work with a number of providers (it's not limited to SQL Server) and has additional goodness such as eSQL and (1) Table-Per-Type inheritance. It can be a bit tricky to learn at first, but once you've done one or two solutions with it, it gets predictable and easier to implement.

    Due to it being the latest, it'll take a bit more in terms of learning curve (also there's more to learn), and the performance is.. less than desirable (at present) but it does offer some interesting benefits (especially the support for multiple providers).

    I guess my question in reply is - are you just evaluating or do you need to produce a workable (production-ready) ORM solution?

    The Entity Framework probably isn't quite ready for serious production work (outside of smaller solutions) which leaves you with LINQ to SQL or NHibernate. If you're only going to be working with SQL Server databases, LINQ to SQL is an interesting option. Otherwise, NHibernate is probably the best bet for serious work.

    (1) [ http://msdn.microsoft.com/en-us/data/cc765425.aspx ] (2) [ http://www.devart.com/dotconnect/linq.html ]

    0 讨论(0)
提交回复
热议问题