1
Operationfinancial
を結合サブクラスのOperation
としてマップします。私が見つけた例とこのモデルの違いは、どちらも複合キーを使用していることです。結合サブクラスとコンポジットキーのマッピング方法
操作マップ。
public class OperationMap : ClassMapping<Operation>
{
public OperationMap()
{
this.Table("ECM_OPE_Operation");
this.ComponentAsId(
x => x.Id, compAsId =>
{
compAsId.Property(x => x.Id, m => { m.Column("Id"); m.NotNullable(true); });
compAsId.Property(x => x.EventId, m => { m.Column("EventId"); m.NotNullable(true); });
});
this.Property(x => x.CreatedOn, map => map.NotNullable(true));
}
}
OperationFinancial Map。
public class OperationfinancialMap : JoinedSubclassMapping<OperationFinancial>, IEntityMap
{
public OperationfinancialMap()
{
this.Table("ECM_OFI_OperationFinancial");
this.Key(m =>
{
m.Column("Id");
m.Column("EventId");
});
this.Property(x => x.Quantity, map => map.NotNullable(true));
this.Property(x => x.Amount);
}
}
しかし、私が実行したときに私はこのエラー
外部キー(FK3EDDC7CF4D8FE893:ECM_OFI_OperationFinancial [のEventId])を持っている)参照される主キーと同じ数の列を持っている必要があります(ECM_OPE_Operation [IDでEventIdを])
いずれか?ここ