I want to mapping bool c# property to Oracle DB. I tried several methods for this. But didn't work. There is no example on web for best solution. My entity as bellow:
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; }
}
From this Fluent mapping example:
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");
}
}
But this and other methods do not work. Please help me.