Can I configure NHibernate to throw exceptions when the value in db is null?

I have a situation where I have a table in which some of the columns are NULL, but I want my NHibernate-based objects to display these values ​​as fields with invalid values. If I do this with a normal mapping, NHibernate assigns a defult value of this type to the object field in the case of a null value. I would like to change this behavior so that an exception is thrown instead. Is it possible?

+3
source share
1 answer

I think you need to change your mapping and add the not-null = "true" attribute.

0
source

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


All Articles