Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用NHibernate在CompositeId映射中设置列_C#_Visual Studio 2013_Fluent Nhibernate_Mapping_Firebird - Fatal编程技术网

C# 如何使用NHibernate在CompositeId映射中设置列

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)

我有一个NHibernate的复合Id映射,我想在所有这些Id中设置一列。可能吗

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();
}
}