FluentNHibernate设置布尔值的默认列值 [英] FluentNHibernate set default column value for a bool

查看:97
本文介绍了FluentNHibernate设置布尔值的默认列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用FluentNHibernate为我的实体为bool类型的字段生成的表的BIT列设置默认值1或0.我认为这没关系,但是无论如何数据库都是sqlserver2005.

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.

推荐答案

您尝试过类似的方法

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

这篇关于FluentNHibernate设置布尔值的默认列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆