Map(x=>x.IsActive).Column("is_active").CustomType<CharBooleanType>()
--
Tim Scott
Lunaverse Software
> --
> You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/l1Aj-Uz8RjkJ.
> To post to this group, send email to fluent-n...@googlegroups.com (mailto:fluent-n...@googlegroups.com).
> To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com (mailto:fluent-nhibern...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.
Try this:Map(x=>x.IsActive).Column("is_active").CustomType<CharBooleanType>()
--
Tim Scott
Lunaverse Software
On Wednesday, September 14, 2011 1:55:39 PM UTC-4, Tim Scott wrote:Try this:Map(x=>x.IsActive).Column("is_active").CustomType<CharBooleanType>()
--
Tim Scott
Lunaverse Software
One of the answers to this post says you can do it with query substitutions alone. You might try that. You probably want to set query substitutions in any case.
http://stackoverflow.com/questions/7404991/fluentnhibernate-how-to-map-database-char-to-c-bool
Otherwise, you can do it for sure with a custom IUserType:
http://lostechies.com/rayhouston/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype/
Copy the sample code and just change the NullSafeGet and NullSafeSet to the behavior you want. Then map your custom type in FNH (instead of CharBooleanType).
> --
> You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/f9yCrRQed_YJ.
> --
> You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/sHWjC5uxiNwJ.
I didn't notice that CharBooleanType is abstract. There's TrueFalseType and YesNo type, neither of which are what you need. Two ideas:One of the answers to this post says you can do it with query substitutions alone. You might try that. You probably want to set query substitutions in any case.
http://stackoverflow.com/questions/7404991/fluentnhibernate-how-to-map-database-char-to-c-bool
Otherwise, you can do it for sure with a custom IUserType:
http://lostechies.com/rayhouston/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype/Copy the sample code and just change the NullSafeGet and NullSafeSet to the behavior you want. Then map your custom type in FNH (instead of CharBooleanType).
Maybe you can use this baseclass this time AND the net time ;-)
http://darrell.mozingo.net/2009/02/10/generic-nhibernate-user-type-base-class/
To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/gdfLrB2oWoQJ.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
Maybe you can use this baseclass this time AND the net time ;-)
http://darrell.mozingo.net/2009/02/10/generic-nhibernate-user-type-base-class/
var amount = NHibernateUtil.Decimal.NullSafeGet(rs, names[0]).To<decimal?>();
I didn't notice that CharBooleanType is abstract. There's TrueFalseType and YesNo type, neither of which are what you need. Two ideas:One of the answers to this post says you can do it with query substitutions alone. You might try that. You probably want to set query substitutions in any case.
http://stackoverflow.com/questions/7404991/fluentnhibernate-how-to-map-database-char-to-c-boolOtherwise, you can do it for sure with a custom IUserType:
http://lostechies.com/rayhouston/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype/Copy the sample code and just change the NullSafeGet and NullSafeSet to the behavior you want. Then map your custom type in FNH (instead of CharBooleanType).
On Thursday, September 15, 2011 at 1:59 PM, Influently NHiberater wrote:
>
>
> On Wednesday, September 14, 2011 3:44:07 PM UTC-4, Tim Scott wrote:
> > I didn't notice that CharBooleanType is abstract. There's TrueFalseType and YesNo type, neither of which are what you need. Two ideas:
> > One of the answers to this post says you can do it with query substitutions alone. You might try that. You probably want to set query substitutions in any case.
> > http://stackoverflow.com/questions/7404991/fluentnhibernate-how-to-map-database-char-to-c-bool
> > Otherwise, you can do it for sure with a custom IUserType:
> > http://lostechies.com/rayhouston/2008/03/23/mapping-strings-to-booleans-using-nhibernate-s-iusertype/
> > Copy the sample code and just change the NullSafeGet and NullSafeSet to the behavior you want. Then map your custom type in FNH (instead of CharBooleanType).
>
> I followed the example at lostechies.com (http://lostechies.com), and this is what I have for NullSafeGet and NullSafeSet:
> To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/q9Nwc_PAsEAJ.