Ich möchte Operationfinancial
als verbundene Unterklassen von Operation
zuordnen. Der Unterschied in diesem Modell von den Beispielen, die ich gefunden habe, ist, dass beide einen zusammengesetzten Schlüssel verwenden.So ordnen Sie eine verbundene Unterklasse einem zusammengesetzten Schlüssel zu
Betriebskarte.
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 Karte.
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);
}
}
Aber wenn ich laufe ich habe diesen Fehler bekam
Fremdschlüssel (FK3EDDC7CF4D8FE893: ECM_OFI_OperationFinancial [EventId])) müssen gleiche Anzahl von Spalten wie die referenzierten Primärschlüssel (ECM_OPE_Operation [Id, EventId ])
Irgendeine Idee?