Page 1 of 1
Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Mon 09 Dec 2019 11:50
by KRU
Hi there,
We are using Devart 9.7.770.0 with EF Core 2.2.4, and we can't seem to succeed in getting ".ValueGeneratedOnAdd()" fluent API configuration to generate our ID primary key columns "GENERATED BY DEFAULT AS IDENTITY" - or any form of "AS IDENTITY" at all, in fact.
Seems like we might be missing something, or maybe we are forced into upgrading our Devart-reference?
Could you confirm whether this is:
A) Correctly a reproducible issue for this Devart version on your end, and
B) Let us know whether our expected end-result (GENERATED BY DEFAULT AS IDENTITY) is achieved if we use the latest Devart version?
Fluent API config:
Code: Select all
builder.Property(x => x.Id).HasColumnType(@"NUMBER").IsRequired().ValueGeneratedOnAdd();
Model column:
Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Fri 13 Dec 2019 19:57
by Shalex
We cannot reproduce the issue with the newest build v9.9.887 of dotConnect for Oracle at the moment.
1. The target Oracle Server version should be 12c or higher. Specify your version.
2. How did you generate the database schema? DbContext.Database.EnsureCreated() or EF Core Migrations or Update To Database Wizard of Entity Developer?
3. Did you specify .HasKey("Id") in your mapping?
Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Thu 23 Jan 2020 09:32
by KRU
Is it possible for you to check if the issue is reproducible on our version, 9.7.770.0 ?
To answer your questions:
1. The target Oracle Server is version 19c
2. The schema was pre-existing, and we added EF Core Code-First migration by "applying" an empty migration. The initial EF Core model was generated using the EF Core template from Entity Developer.
3. Yes.
Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Fri 24 Jan 2020 19:03
by Shalex
Let us know whether our expected end-result (GENERATED BY DEFAULT AS IDENTITY) is achieved
The schema was pre-existing
If the ID primary key column "GENERATED BY DEFAULT AS IDENTITY" has already been created in your schema, the problem is not clear.
Please
send us a small complete test project with the corresponding DDL/DML script for reproducing the issue you have encountered.
Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Thu 06 Feb 2020 08:12
by KRU
I meant that we had an existing database with an existing schema and some existing tables with data, etc.
We activated EF Core Code-First by applying an empty migration onto that existing database.
Then we wanted to create a new table, at which point we identified the issue.
We will have to look into reproducing the issue, perchance experimenting with upgrading our Devart version as well. This work is postponed for now however, since we have made a temporary workaround of adding an SQL-migration which changed the ID column to be an IDENTITY column.
Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Mon 10 Feb 2020 17:59
by Shalex
We have reproduced the issue and will notify you when it is fixed.
Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))
Posted: Mon 02 Mar 2020 15:38
by Shalex
The bug with missing GENERATED BY DEFAULT AS IDENTITY in the script created by EF Core Migrations for the property with .HasColumnType(@"NUMBER").ValueGeneratedOnAdd() is fixed in v9.11.951:
viewtopic.php?f=1&t=39884.