ColumnAttribute.IsDbGenerated ColumnAttribute.IsDbGenerated ColumnAttribute.IsDbGenerated ColumnAttribute.IsDbGenerated Property

定義

取得或設定資料行是否包含資料庫自動產生的值。Gets or sets whether a column contains values that the database auto-generates.

public:
 property bool IsDbGenerated { bool get(); void set(bool value); };
public bool IsDbGenerated { get; set; }
member this.IsDbGenerated : bool with get, set
Public Property IsDbGenerated As Boolean

屬性值

預設值 = falseDefault = false.

範例

[Column(Storage="_OrderID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int OrderID
{
	get
	{
		return this._OrderID;
	}
	set
	{
		if ((this._OrderID != value))
		{
			this.OnOrderIDChanging(value);
			this.SendPropertyChanging();
			this._OrderID = value;
			this.SendPropertyChanged("OrderID");
			this.OnOrderIDChanged();
		}
	}
}
<Column(Storage:="_OrderID", AutoSync:=AutoSync.OnInsert, DbType:="Int NOT NULL IDENTITY", IsPrimaryKey:=true, IsDbGenerated:=true)>  _
Public Property OrderID() As Integer
	Get
		Return Me._OrderID
	End Get
	Set
		If ((Me._OrderID = value)  _
					= false) Then
			Me.OnOrderIDChanging(value)
			Me.SendPropertyChanging
			Me._OrderID = value
			Me.SendPropertyChanged("OrderID")
			Me.OnOrderIDChanged
		End If
	End Set
End Property

備註

IsDbGenerated成員會在插入資料列之後立即同步處理,而且成員可以在完成之後SubmitChanges使用。IsDbGenerated members are synchronized immediately after the row of data is inserted, and the members are available after SubmitChanges is completed.

注意

如果資料行包含主鍵值,而且您指定IsDbGeneratedtrueDbType您也應該使用IDENTITY修飾詞來加入屬性。If the column holds primary key values and you designate IsDbGenerated as true, you should also add the DbType property by using the IDENTITY modifier.

適用於