次の設定で関連付けプロパティを作成したいと思います。
public class ClassType1{
[Key]
public int type1_ID { get;set; }
public int type2_ID { get;set; } // In database, this is a foreign key linked to ClassType2.type2_ID
public ClassType2 type2Prop { get;set; }
}
public class ClassType2{
[Key]
public int type2_ID { get;set; }
}
私の問題は、type2Prop が外部キーを見つけられないことです。本当に「type2_ID」を探すべきなのに、存在しない「type2Prop_ID」を探そうとしている。これが私が得るエラーです:
{"Invalid column name 'type2Prop_ID'."}
ClassType2 のキーとして使用するプロパティを指定するにはどうすればよいですか?