【发布时间】:2010-09-01 14:33:22
【问题描述】:
FNH 映射中的新SetAttribute() 是什么?我需要在子类上设置我的鉴别器值,因为 String 不是首选 - old post
NH 2.1.2.4000,FNH 1.1.0.689
public class BaseBuildingMap : ClassMap<BaseBuilding>
{
public BaseBuildingMap()
{
Id(x => x.Id);
DiscriminateSubClassesOnColumn<int>("BuildingType", -1);
}
}
public class PowerStationMap : SubclassMap<PowerStation>
{
public PowerStationMap()
{
Map(x => x.ElectricityProduction);
}
}
NHibernate.MappingException:无法将鉴别器值格式化为实体 Model.Test.PowerStation 的 SQL 字符串 ---> System.FormatException:输入字符串的格式不正确。
我需要设置SetAttribute("discriminator-value", "-1");,但是没有这个方法。
编辑 1
问题:如何使用 FNH 为子类设置区分列类型?
【问题讨论】:
标签: c# nhibernate fluent-nhibernate nhibernate-mapping