ColumnAttribute.IsVersion 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定成員的欄位類型是資料庫時間戳記還是版本號。
public:
property bool IsVersion { bool get(); void set(bool value); };
public bool IsVersion { get; set; }
member this.IsVersion : bool with get, set
Public Property IsVersion As Boolean
屬性值
預設值 = false。
範例
[Column(Storage = "_VersionNum", DbType = "Int NOT NULL IDENTITY", IsVersion=true)]
public int VersionNum
{
get
{
return this._VersionNum;
}
set
{
if ((this._VersionNum != value))
{
this._VersionNum = value;
}
}
}
<Column(Storage:="_VersionNum", DbType:="Int NOT NULL IDENTITY", IsVersion:=True)> _
Public Property VersionNum() As Integer
Get
Return Me._VersionNum
End Get
Set(ByVal value As Integer)
If ((Me._VersionNum = value) _
= False) Then
Me._EmployeeID = value
End If
End Set
End Property
備註
版本號會遞增,且每次相關資料列更新時,時間戳記欄位也會更新。 (此特性告訴 LINQ 對 SQL,欄位應更新以顯示為新版本;它並非用來記錄更新者。)
當 為真時 IsVersion 請注意以下點:
版本號會遞增,且每次相關資料列更新時,時間戳記欄位也會更新。 與 的 IsVersion=true 成員在資料列更新後立即同步。 新數值會在完成後顯示 SubmitChanges 。