问题
How to set with FluentNHibernate the default value of 1 or 0 for a BIT column of the table generated from my entity for the field of type bool. I think it doesn't matter but in any case the database is sqlserver2005.
回答1:
Have you tried something like this
this.Map(x => x.SomeBitColumn) .Access.Property() .Default("1");
回答2:
You probably want to look at using NHibernate Validator for this, here is an ayende example for something close to what you are looking for. They give greater control over what would be created within schema exports as well.
来源:https://stackoverflow.com/questions/1000182/fluentnhibernate-set-default-column-value-for-a-bool