ColumnAttribute.IsDbGenerated Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Property Value
Default = false
.
Examples
[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
Remarks
IsDbGenerated members are synchronized immediately after the row of data is inserted, and the members are available after SubmitChanges is completed.
Note
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
Обратна връзка
https://aka.ms/ContentUserFeedback.
Очаквайте скоро: През цялата 2024 г. постепенно ще отстраняваме проблемите в GitHub като механизъм за обратна връзка за съдържание и ще го заменим с нова система за обратна връзка. За повече информация вижте:Подаване и преглед на обратна връзка за