views:

72

answers:

1

I am working on a project that requires the use of multiple databases that for the most part are completely identical but some columns might be missing. How do you get NHibernate to handle this for instance i have a table with 4 columns an index and 2 data coloumns that will always be availible but a singe customer does not want the column in their database.

as this is part of a legacy application migration i do not have the luxury of dictating the database format or even change the databases. anybody have any ideas of how to do this. I cannot get NHibernate shards to work with this either.

KR Nicky

+1  A: 

I don't know of a way to tell NHibernate to ignore columns that are otherwise mapped.

I would look at creating multiple mappings files for the different databases and then depending on your environment configure your SessionFactory using the correct mapping files.

This may seem like a little more work to setup initially but it makes it very clear that in database X you have columns A-B-C and in database Y you only have columns A-B.

Andrew Hanson
The problem is that we currently are using the samme mapping for around 50 databases to split different companies data (Legal requirement.) so mapping out for each database is viable but unmaintainable in this case.
Nicky