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> 对于) 为 EntitySet<TEntity> 0-n,则假定为 true。

适用于