Sto utilizzando Entity Framework 4.3 code-first con Oracle. Sto ottenendo il seguente errore:Mapping di una chiave esterna con un nome di colonna personalizzato
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.
I miei soggetti sono come questo:
[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; }
}
Il mio codice sembra corretto. Cosa ho fatto di sbagliato, qui?
Grazie per la risposta. Che dire di questo problema? Potresti dare un'occhiata per favore? Grazie in anticipo ... http://stackoverflow.com/questions/29333787/how-to-create-lookup-table-and-define-relationships –