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 for EntityRef<TEntity> 或 0-n for EntitySet<TEntity>)假定为 true。

适用于