Type conversion
Posted: Mon 19 Nov 2012 13:54
I have a short integer that I want to convert to a boolean (zero = false, non-zero = true). I've written the class SmallIntBoolean which implements NHibernate's IUserType interface to do this. However, when I set the 'Type' property to SmallIntBoolean in the column's property editor the following is generated:
If I were doing it by hand I would do this:
Also, it creates a target property of type SmallIntBoolean:
But I want a boolean:
How can I do this conversion in Entity Developer?
Thanks.
Code: Select all
Map(x => x.IsMainAddress)
.Column("PRIMARY_ADDRESS")
.CustomType("SmallIntBoolean")
.Access.Property()
.Generated.Never()
.CustomSqlType("smallint")
.Precision(5);
Code: Select all
Map(x => x.IsMainAddress)
.Column("PRIMARY_ADDRESS")
.CustomType<SmallIntBoolean>()
.Access.Property()
.Generated.Never()
.CustomSqlType("smallint")
.Precision(5);
Code: Select all
public virtual SmallIntBoolean IsMainAddress { get/set... }
Code: Select all
public virtual bool IsMainAddress { get/set... }
Thanks.