How to make Nhibernate handle non-existing database columns gracefully

I am working on a project that requires the use of several databases, which for the most part are completely identical, but some columns may be missing. How do you get NHibernate to handle this, for example, I have a table with 4 index columns and 2 coloumns data that will always be available, but the only client does not want the column in their database.

since this is part of porting legacy applications, I don’t have the luxury to dictate the format of the database or even change the database. anyone have any ideas how to do this. I also can't get NHibernate fainting to work with this.

KR Nicky

+3
source share
1 answer

I do not know how to tell NHibernate to ignore columns that are otherwise displayed.

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

This may seem a little more complicated for the initial setup, but it’s very clear that the database X has ABC columns, and the database Y has only AB columns.

+1
source

Source: https://habr.com/ru/post/1713343/


All Articles