Page 1 of 1

PostgreSql Serial/Auto-increment PK

Posted: Thu 11 Jun 2015 18:05
by OutOfTouch6947
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.

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

Re: PostgreSql Serial/Auto-increment PK

Posted: Fri 12 Jun 2015 13:23
by MariiaI
We are sending you a small test project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.
Some useful information is available here:
https://www.devart.com/linqconnect/docs ... ation.html
https://www.devart.com/linqconnect/docs ... gData.html
https://www.devart.com/linqconnect/docs ... hecks.html

Also, you can check the generated SQL queries via LinqMonitor or Log property of your DataContext object. For more information please refer to
http://www.devart.com/linqconnect/docs/?Monitoring.html

If you have any further questions, feel free to contact us.