开发者

Fluent NHibernate beginner problem: How to convert single column data to custom class?

开发者 https://www.devze.com 2022-12-30 11:42 出处:网络
I am very new to Fluent NHibernate and I have a problem that I cant find the answer to. I have a string column in my database table, containing a mathematical expression i.e: \"10 + 15 * 5\". On my e

I am very new to Fluent NHibernate and I have a problem that I cant find the answer to.

I have a string column in my database table, containing a mathematical expression i.e: "10 + 15 * 5". On my entity I have a property that I call Formula and this returns a class that contains the mathematical "formula" (not as a string)开发者_如何学编程.

I beleive this post http://intellect.dk/post/Implementing-custom-types-in-nHibernate.aspx explains how to solve it for NHibernate. But I am not sure...

How do I get this working with Fluent NHibernate?


Once you've created your user type (which is what your link is about), you then just need to specify it on the property.

Map(x => x.YourProperty)
  .CustomType<YourUserType>();
0

精彩评论

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