开发者

how do you translate a space value in a database field to a null in .NET with Fluent NHibernate?

I am working with a legacy database that stores "blank" values as a single space. Is there a way with Fluent NHibernate, either by way of a convention or mapping override, that I can translate this "blank" value as a .NET null? (I know that I will need to save nulls to this database as a single space still but I will use an save event listener for that)开发者_开发技巧.


You should use a custom implementation of IUserType for this, not a listener. Here's one example of many examples available on the web. James Gregory wrote a good article on how to implement IUserTypes using a Fluent NHibernate conventions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜