PostgreSql Serial/Auto-increment PK
Posted: Thu 11 Jun 2015 18:05
How does Entity Developer handle inserting versus editing rows where the primary key is Serial?
Also when inserting is there a way to get the ID back?
Here is what I mean.
Also when inserting is there a way to get the ID back?
Here is what I mean.
Code: Select all
[Column(Name = @"scorecard_id", Storage = "_ScorecardId", AutoSync = AutoSync.OnInsert, CanBeNull = false, DbType = "SERIAL NOT NULL", IsDbGenerated = true, IsPrimaryKey = true)]
[System.ComponentModel.DataAnnotations.Key]
[System.ComponentModel.DataAnnotations.Required(ErrorMessage = @"Value is required.")]
public int ScorecardId
{
get
{
return this._ScorecardId;
}
set
{
if (this._ScorecardId != value)
{
this.OnScorecardIdChanging(value);
this.SendPropertyChanging();
this._ScorecardId = value;
this.SendPropertyChanged("ScorecardId");
this.OnScorecardIdChanged();
}
}
}