开发者

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

I have a situation where I have a table where some of the columns are nullable, but I want my NHiber开发者_Go百科nate-based entities to expose those values as non-nullable fields. If I do this with a normal mapping, NHibernate assigns the defult value of the type to the entity's field in the case of a null value. I would like to change this behavior so that instead an exception is thrown. Is this possible?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜