私はOracleでEntity Framework 4.3を最初に使用しています。私は次のエラーを取得しています:カスタムの列名を持つ外部キーのマッピング
System.InvalidOperationException : The ForeignKeyAttribute on property 'WidgetSequence' on type 'WidgetDistributor.WidgetEntity' is not valid. The foreign key name 'WIDGETSEQUENCE_ID' was not found on the dependent type 'WidgetDistributor.WidgetEntity'. The Name value should be a comma separated list of foreign key property names.
私のエンティティは、このようなものです:
[Table("WIDGETENTITIES")]
public class WidgetEntity {
[Column("WIDGETENTITY_ID")]
public int Id { get; set; }
[ForeignKey("WIDGETSEQUENCE_ID")]
public WidgetSequence Sequence { get; set; }
// and other properties that map correctly
}
[Table("WIDGETSEQUENCES")]
public class WidgetSequence {
[Column("WIDGETSEQUENCE_ID")]
public int Id { get; set; }
[Column("NUMBER")]
public int Number { get; set; }
}
私のコードが正しいようです。私は何を間違えたのですか?
ありがとう:
は、私はこのような外部キーをマップするためのForeignKeyアノテーションを使用することができますよ。この問題はどうですか?どうぞご覧ください。事前に感謝... http://stackoverflow.com/questions/29333787/how-to-create-lookup-table-and-define-relationships –