FluentNHibernate sets the default column value for bool

How to set the default value of 1 or 0 with FluentNHibernate for the BIT column of the table generated from my object for a field of type bool. I think it does not matter, but in any case, the database is sqlserver2005.

+4
source share
2 answers

Have you tried something like this

this.Map(x => x.SomeBitColumn) .Access.Property() .Default("1"); 
+5
source

You probably want to look at using the NHibernate Validator for this, here is an ayende example for something close to what you are looking for. They give more control over what will be created as part of the export scheme.

0
source

Source: https://habr.com/ru/post/1286276/


All Articles