Question

I know these questions been asked numerous times, but some of the questions are 6+ months, and products evolve.

I have a database schema, newly designed by some real pro's, beautiful in it's construction, sitting in Enterprise Architect, ready to be generated into any database engine type that's required. I don't want to dump it, just yet. Its around 3-4k tables.

I have a number of questions really. I undertstand from reading stack and various blogs that Fluent NHibernate with Automappings and Conventions is the best way, when using NHibernate, to construct a domain layer that integrates well with a legacy db. I know it is subjective, but is that still true?

Is there any example or open source projects that use FH to map to a existing database, to see how it works on the large scale.

Also before I go, does anybody have any experience of using a commercial toolset for this? What is the state of art at the moment. I've looked at a whole bundle but many of the docs are geared for greenfield, and it's hard to determine what would be the best choice if FH was ruled out. It would take a formal product testing, metrics and a report created to determine the best choice, but experience counts.

Thanks. Any help would be appreciated. Bob.

Was it helpful?

Solution

I've used native NHibernate mappings as well as FNH against legacy databases. The benefit of FNH, IMHO, is really expressed when you can use the AutoMapping features. For a legacy database, assuming there are solid conventions used in the construction of the schema, it's a relatively trivial thing to create custom FluentNHibernate Convention classes that then get used in conjunction with the AutoMap features. You don't have to AutoMap, though, and the ClassMap (and/or Overrides of the AutoMap) can give you all the flexibility you need to work against the existing schema. Of course, this is subjective. Some would argue that the NHibernate XML mapping files are better against legacy apps as you're explicitly managing the mappings. To each his own. I've done both, and have seen pros/cons of both. I prefer FNH when NHibernate is the chosen O/RM.

Check out SharpArchitecture for examples of FNH (and other NHibernate practices). It's been awhile since I've pulled their source, but the last time I wandered through it, it was a good example of what NHibernate and FNH are capable of.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top