Bug Report T312307
Visible to All Users

PostgreSqlConnectionProvider doesn't set DBColumn.IsIdentity for an auto-incrementing primary key column when reading the schema

created 9 years ago

I'm testing with 15.1 XPO accessing a PostgreSQL 9.2 database. I have a table defined as follows:

SQL
CREATE TABLE public.a_prueba ( id SERIAL, nombre VARCHAR(20), apellido VARCHAR(20), edad INTEGER, CONSTRAINT a_prueba_pkey PRIMARY KEY(id) ) WITH OIDS;

I proceed to add a new item with DevExpress ORM Data Model Wizard
generating the following code :

C#
public partial class a_prueba : XPLiteObject { int fid; [Key] public int id { get { return fid; } set { SetPropertyValue<int>("id", ref fid, value); } } string fnombre; [Size(20)] public string nombre { get { return fnombre; } set { SetPropertyValue<string>("nombre", ref fnombre, value); } } string fapellido; [Size(20)] public string apellido { get { return fapellido; } set { SetPropertyValue<string>("apellido", ref fapellido, value); } } int fedad; public int edad { get { return fedad; } set { SetPropertyValue<int>("edad", ref fedad, value); } } }

As can be seen, the wizard generates the id field as [key] instead of generating it as [Key (true)].
In the Data Model Designer, the property "Is Identity" is generated as "False". In a small database, just change the property to true; but in a database with lots of tables, maintenance is difficult, and even worse when using the "Update Model from Database" option, all changes made are lost.
How to avoid this loss? or better yet how to make the Wizard generates the "Is Identity" property to "True" in these cases with auto-incrementing key fields.

The situation is the same in the case of creating a table without OIDs.

SQL
CREATE TABLE public.a_prueba2 ( id SERIAL, nombre VARCHAR(20), apellido VARCHAR(20), edad INTEGER, CONSTRAINT a_prueba2_pkey PRIMARY KEY(id) ) WITHOUT OIDS;

Thanks

Fernando

Comments (3)
DevExpress Support Team 9 years ago

    Hello Fernando.

    Thank you for your report. The current version of PostgreSqlConnectionProvider doesn't detect auto-incrementing columns. We will consider this functionality for future updates of our components.

    FP FP
    Fernando Prada 9 years ago

      Ok, keep waiting with each release of DevExpress this functionality, for now I will continue with the Entity Framework … the more I see my project grows more distant the possibility of buying and migrate XPO; Details like this make me wonder about a possible migration.
      Thank you.

      DevExpress Support Team 9 years ago

        Thank you for your feedback, Fernando.

        Answers approved by DevExpress Support

        created 9 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.