I am embarrassed to say it, but I must. I haven't labored with ORM's. I am really thinking about NHibernate because it appears to become probably the most mature product for .Internet available (please correct me if I am wrong). Now, the truth is that you will find there's large e-commerce/booking system by having an SqlServer because the primary integration point, that contains a great deal of business logic in sprocs. Now - clearly - this architecture is one thing you want to escape from, and we have been doing this for a while, slowly. So, my question for you is how achievable could it be to begin using NHibernate for brand new features and never returning and map all of the legacy stuff? Is type of gradual introduction of and ORM supported, and when so, can you recommend it?

If you work with legacy databases, you will discover ORM tools rather hard to use, configure, maintain and optimize. We went in to the many issues whenever we used NHibernate to map our Domain Model for an existing database. A number of them were:

  1. The Model objects were hard to map to existing tables (we'd on the 100 tables), a number of NHibernate's needs were quite obtrusive like all table should have an ID area to have the ability to be planned right into a Domain object. Also, mapping many to a lot of associations was very difficult to understand and employ.

  2. Maintaining the big amount of mapping XML needed to map to legacy database grew to become a complete time project for a developer and was quite challenging, specifically inside a team of 10+ designers.

  3. Our queries degraded in performance as complexity increased because the Data model and Object model didn't always match the busineess and must be constantly updated. A lot of data aggregation code needed to be written. For instance, as we required to show a power grid which became a member of multiple tables, we once had to load multiple Domain objects place them together and demonstrate to them in a single power grid. That code was tough to maintain and debug.

  4. Also, we sometimes needed to run anonymous queries, i.e. where we simply wanted a couple of qualities from some objects and never the entire objects. Which was very hard to create, maintain as well as implement and was going from the ORM paradigm, but we'd no choice but to do this.

  5. One other issue we went into could be that the Database was constantly altering because the DBAs would refactor the tables which would always break our Domain objects. It had been an excercise to help keep the Models and Tables in synch as well as make certain the Application still labored.

Lengthy story short ... What we should found that if there is a method to map the SQL that business needed right to our UI Model or Domain objects without needing to be worried about configuration, it might be a much better solution.

After dealing with this experience we developed the Orasis Mapping Studio. It's a mapping tool particularly made to prevent legacy databases as well as existing .Internet Model / Domain objects. It requires your SQL queries and enables you to definitely map these to your existing .Internet objects by showing the metadata from the Query and also the Object graphically and taking advantage of drag and drop to produce mappings between Object qualities and Query posts. The tool instantly creates all of the ADO.Internet code you should perform your mapping to see your objects. After that you can make use of the produced code inside your DAL Layer or make use of the produced Set up to retrieve and persist your computer data.

You can test it here: Orasis Mapping Studio. It's a tool that people believe designers actually need, specifically for dealing with legacy databases and where performance is really a key requirement. It's compiled by designers for designers therefore it handles a few of the intricate particulars like Obejct inheritance, nested objects, data type conversions, etc. Best Of Luck!

It'll rely on how "NHibernate friendly" your present database is. NHibernate likes single column primary secrets (if they're all named "id" better still). Most ORM are not so saved proc friendly so far as I understand. Have you consider how you will define your transfer objects to obtain data both to and from the db?

BTW there's absolutely nothing to be embarrassed with. ORM's really are a goot factor but you're in trying to get the best approach.