0
我想將bool c#屬性映射到Oracle DB。我嘗試了幾種方法。但沒有奏效。網上沒有例子可以找到最佳解決方案。 我作爲波紋管實體:Fluent NHibernate:將Bool屬性映射到ORACLE DB
public class Department : EntityBase<short>
{
[JsonIncludeProperty(NameOfSet = "list")]
public virtual string Name { get; set; }
public virtual Department ParentDepartment { get; set; }
public virtual IList<Department> ChildDepartments { get; set; }
// Bool value
public virtual bool IsActive { get; set; }
}
從this流利的映射例如:
public class DepartmentMap : ClassMap<Department>
{
public DepartmentMap()
{
Table("DEPARTMENTS");
LazyLoad();
Id(x => x.Id)
.GeneratedBy.Sequence("DEPARTMENTS_SEQ")
.Not.Nullable()
.Column("DEPARTMENT_ID")
.CustomSqlType("NUMBER(5,0)");
Map(x => x.Name).Not.Nullable().Column("DEPARTMENT_NAME").CustomSqlType("NVARCHAR2(100)");
Map(department => department.IsActive).Not.Nullable().Column("IS_ACTIVE").CustomType<YesNoType>();
HasMany(x => x.ChildDepartments)
.AsList()
.Inverse()
.Cascade.All()
.KeyColumn("PARENT_DEPARTMENT_ID");
References(x => x.ParentDepartment, "PARENT_DEPARTMENT_ID");
}
}
但是這和其他方法不起作用。請幫幫我。
「沒有工作」/「不工作」對於解釋發生了什麼問題太短了。見[這個頁面](http://www.catb.org/~esr/faqs/smart-questions.html#beprecise),由[SO如何問](/幫助/如何問)引用。 –