共用方式為


AssociationAttribute.OtherKey 屬性

定義

取得或設定目標實體類別的一個或多個成員,做為關聯另一端的索引鍵值。

public:
 property System::String ^ OtherKey { System::String ^ get(); void set(System::String ^ value); };
public string OtherKey { get; set; }
member this.OtherKey : string with get, set
Public Property OtherKey As String

屬性值

預設 = 相關類別的 ID。

範例

[Association(Name="FK_Products_Categories", Storage="_Products", OtherKey="CategoryID", DeleteRule="NO ACTION")]
public EntitySet<Product> Products
{
    get
    {
        return this._Products;
    }
    set
    {
        this._Products.Assign(value);
    }
}
<Association(Name:="FK_Products_Categories", Storage:="_Products", OtherKey:="CategoryID", DeleteRule:="NO ACTION")>  _
Public Property Products() As EntitySet(Of Product)
    Get
        Return Me._Products
    End Get
    Set
        Me._Products.Assign(value)
    End Set
End Property

備註

對於多個成員,請使用逗號分隔清單。

不需要索引鍵才能比對主鍵或外鍵,但使用者陳述的基數 (為 0-1 EntityRef<TEntity> ,或假設) 為 0-n EntitySet<TEntity>

適用於