Bagikan melalui


ColumnAttribute.IsDbGenerated Properti

Definisi

Mendapatkan atau mengatur apakah kolom berisi nilai yang dihasilkan secara otomatis database.

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

Nilai Properti

Default = false.

Contoh

[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

Keterangan

IsDbGenerated anggota disinkronkan segera setelah baris data disisipkan, dan anggota tersedia setelah SubmitChanges selesai.

Catatan

Jika kolom menyimpan nilai kunci primer dan Anda menunjuk IsDbGenerated sebagai true, Anda juga harus menambahkan DbType properti dengan menggunakan pengubah IDENTITY .

Berlaku untuk