ColumnAttribute.IsDiscriminator 属性
定义
获取或设置一个值,该值指示列是否包含 LINQ to SQL 继承层次结构的鉴别器值。Gets or sets whether a column contains a discriminator value for a LINQ to SQL inheritance hierarchy.
public:
property bool IsDiscriminator { bool get(); void set(bool value); };
public bool IsDiscriminator { get; set; }
member this.IsDiscriminator : bool with get, set
Public Property IsDiscriminator As Boolean
属性值
默认值 = false。Default = false.
示例
[Column(Storage="_Title", DbType="NVarChar(30)",IsDiscriminator=true)]
public string Title
{
get
{
return this._Title;
}
set
{
if ((this._Title != value))
{
this.OnTitleChanging(value);
this.SendPropertyChanging();
this._Title = value;
this.SendPropertyChanged("Title");
this.OnTitleChanged();
}
}
}
<Column(Storage:="_Title", DbType:="NVarChar(30)", IsDiscriminator:=True)> _
Public Property Title() As String
Get
Return Me._Title
End Get
Set(ByVal value As String)
If ((Me._Title = Value) _
= False) Then
Me.OnTitleChanging(Value)
Me.SendPropertyChanging()
Me._Title = Value
Me.SendPropertyChanged("Title")
Me.OnTitleChanged()
End If
End Set
End Property
注解
如果 true 为,则此属性将类成员标识为包含继承层次结构的鉴别器值。When true, this property identifies the class member as holding the discriminator value for an inheritance hierarchy.
您可以将此属性设置为, true 以便不能有多个成员,该成员必须属于层次结构中的最顶层映射类。You can set this property to true for no more than one member, which must belong to the topmost mapped class in the hierarchy.