C# 如何使用NHibernate在CompositeId映射中设置列
我有一个NHibernate的复合Id映射,我想在所有这些Id中设置一列。可能吗C# 如何使用NHibernate在CompositeId映射中设置列,c#,visual-studio-2013,fluent-nhibernate,mapping,firebird,C#,Visual Studio 2013,Fluent Nhibernate,Mapping,Firebird,我有一个NHibernate的复合Id映射,我想在所有这些Id中设置一列。可能吗 public class MapProduction : ClassMap<Production> { public MapProduction() { CompositeId() .KeyProperty(c => c.ProductionCode) .KeyProperty(c => c.Cycle)
public class MapProduction : ClassMap<Production>
{
public MapProduction()
{
CompositeId()
.KeyProperty(c => c.ProductionCode)
.KeyProperty(c => c.Cycle)
.KeyProperty(c => c.Crop)
.KeyProperty(c => c.TechnologyLevel);
Map(c => c.Area).Column("A_ARE");
Map(c => c.Productivity).Column("P_ARE");
Map(c => c.syncStatus).ReadOnly();
}
}
公共类映射产品:类映射
{
公共地图制作()
{
复合ID()
.KeyProperty(c=>c.ProductionCode)
.KeyProperty(c=>c.Cycle)
.KeyProperty(c=>c.Crop)
.KeyProperty(c=>c.TechnologyLevel);
Map(c=>c.Area)列(“A_是”);
Map(c=>c.Productivity);
Map(c=>c.syncStatus).ReadOnly();
}
}
如果我只有一个id,我可以设置一个列,但对于复合id,我不能
我怎样才能做到这一点?我找到了如何做到这一点。
在CompositeId中,有一个参数用于添加表引用
public class MapProduction : ClassMap<Production>
{
public MapProduction()
{
CompositeId()
.KeyProperty(c => c.ProductionCode, "P_PRO")
.KeyProperty(c => c.Cycle, "C_CIC")
.KeyProperty(c => c.Crop, "C_CUL")
.KeyProperty(c => c.TechnologyLevel, "C_NVT");
Map(c => c.Area).Column("A_ARE");
Map(c => c.Productivity).Column("P_ARE");
Map(c => c.syncStatus).ReadOnly();
}
}
公共类映射产品:类映射
{
公共地图制作()
{
复合ID()
.KeyProperty(c=>c.ProductionCode,“P_PRO”)
.KeyProperty(c=>c.循环,“c_CIC”)
.KeyProperty(c=>c.Crop,“c_CUL”)
.KeyProperty(c=>c.TechnologyLevel,“c_NVT”);
Map(c=>c.Area)列(“A_是”);
Map(c=>c.Productivity);
Map(c=>c.syncStatus).ReadOnly();
}
}