PostgreSql Serial/Auto-increment PK

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

PostgreSql Serial/Auto-increment PK

Post by OutOfTouch6947 » 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.

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: PostgreSql Serial/Auto-increment PK

Post by MariiaI » Fri 12 Jun 2015 13:23

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.

Post Reply