MS Entity Framework VS NHibernate and its derived contribs (FluentNHibernate, Linq for NHibernate)

后端 未结 3 1958
忘掉有多难
忘掉有多难 2021-01-31 06:34

I just read this article about the Entity Framework 4 (actually version 2).

Entity Framework seems to offer a huge improvement over its first release. Thus, I have never

相关标签:
3条回答
  • 2021-01-31 06:34

    Take this with a grain of salt. I am not any kind of authority on ORM tools, but here it goes...

    One of the biggest benefits that i see in EF is the GUI for mapping. IMO, this saves a lot of time, but is probably the reason why EF XML mappings are so verbose. They're not made to be dealt with manually, unfortunately. Whether it will change or not i don't know. What i do know is that the GUI that EF provides used to be very flaky in previous releases. And i still hear about people complaining that it isn't scaling well, especially on larger and more complex schemas where it just misses things and you end up messing with the mappings directly. My opinion is that XML maps will become less verbose as EF matures. You also have the fluent mapping support in EF, which is also helpful. Finally, another big thing is the ability to change code templates that EF generates, that is if you favor database-driven design instead of design-first approach.

    Another benefit is that it comes from Microsoft and they have enough dough to make this a really dope framework. It has grown tremendously in the past few years. I think it'll be on the same ground with NHibernate in a little over a year. As of now, I think NHibernate is a better choice. It's more stable and mature. Relative easy to configure and most importantly a better performer. I think if you design wisely, a move from one to another is going to be a piece of cake.

    EF is just an abstraction. I believe there are providers for Oracle, so i don't see why there couldn't be more added as it grows.

    0 讨论(0)
  • 2021-01-31 06:34

    Will EF4 tend to be less XML-verbose?

    In general, I have not seen any indication that the XML will be drastically different. Microsoft is providing a Fluent like interface to EF in v4, but it's an add on / separate download.

    Will EF4 be compatible with other underlying datastore than just SQL Server?

    It is compatible now and it will remain compatible going forward. LinqToSql is SQL Server only, but EF has never been SQL Server only.

    What are the greatest benefits of going with EF4 instead of FluentNHibernate or NHibernate itself?

    Honestly, there aren't many. There are little things here and there that are different, but in general NHibernate is still years ahead of EntityFramework, even in EFv4.

    As a consultant, it is probably worth your time to become an expert in both NHibernate and Entity Framework. You will probably continue to see them both in the real world. Microsoft tends to have a short attention span when it comes to data access so it's not clear where Entity Framework will be a couple of years from now. Because it's from Microsoft, you can be sure that plenty of developers will use EF.

    0 讨论(0)
  • 2021-01-31 06:45

    I know almost nothing about EF, but a quick skim of the links provided leads me to believe that EF has no equivilent to Fluent NHibernate's Automapping functionality.

    Edit: Some of the commenters pointed me to links indicating there is some automapping in EF, but it's not really clear if it's as powerful as FNH (for example, being able to automap collections of other objects).

    Personally, I love being able to design POCOs in an OO manner, and letting the tool handle all the busy work of mapping to a relational database.

    FNH still has the most powerful automapping capability, as far as I know.

    Go to Fluent NHibernate Automapping for more info.

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