ColumnAttribute.IsDbGenerated Property

Definition

Gets or sets whether a column contains values that the database auto-generates.

C#
public bool IsDbGenerated { get; set; }

Property Value

Default = false.

Examples

C#
[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();
        }
    }
}

Remarks

IsDbGenerated members are synchronized immediately after the row of data is inserted, and the members are available after SubmitChanges is completed.

Napomena

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.

Applies to

Proizvod Verzije
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1