Moving from Entity Framework to NHibernate
Currently we have 2 databases that we are going to use. One comes from a pre-existing product and thus we have no control over it. the other is one that we have full control over.
Currently we use the EF4 CTP as we need spatial features but obviously this cannot be used in product code and the recent release of EF hasn't spatial as this is for a later release of the .Net Framework and so the decision is being made as to the way forward and one suggestion is to move to NHibernate and use the spatial addon.
So first question is regarding the learning curve and move between the tools. To my eyes it seems NHibernate is more visible on what it is doing, EF hides a lot of what it does in typical MS style, would that be fair?
So I am thinking the way forward is to use a class diagram to describe the database that we have control of. We then would create the POCO lasses from that and then you need to create mapping files. Is it really as straight-forward as that? These mapping files, do we need to manually write them or do we have a tool to create from the POCO classes?
The next question is regarding the pre-existing database and what we do here. EF makes it easy to import the database and create the classes and is it as straight-forward in NHibernate?
In case it affects the answers
The database we have control of uses a MS SQL database. The one we don't is Oracle and we use the ODAC Entity Framework code from Oracle.
Thank you very much
For an existing database, I recommend using Fluent NHibernate for the mapping. There is a good example of this in the Sharp Architecture project
There are tools that do both POCO generation and Fluent Mapping, I haven't tried any of them but I have read about them.
链接地址: http://www.djcxy.com/p/10342.html