答えて

0

例えばこれを持っ:

public class Table1 
{ 
[Key] 
int ID{get; set;} 
Table2 table2{get; set;} 
} 
public class Table2 
{ 
[Key] 
int ID{get; set;} 
int table1ID{get; set;} 

[ForeignKey("table1ID")] 
Table1 table1{get; set;} 
//no instance of table i.e is relationship is uni-directional only 
} 

これはTable2Table1参照(table1)を持っており、それが外部キーが「table1ID」に設定するForeignKeyAttributeによって指定されています、ということを意味します。

+0

これは私が必要としているものではありません@RhymechaeT – RollerCosta

+0

私は誤解したにちがいありません。あなたは "table1ID"の権利を介してこれらの2つのテーブルを関連づけたかったのですか? –