Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
KRU
Posts: 5
Joined: Tue 08 Oct 2019 11:51

Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by KRU » Mon 09 Dec 2019 11:50

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:

Code: Select all

public int Id { get; set; }

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by Shalex » Fri 13 Dec 2019 19:57

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?

KRU
Posts: 5
Joined: Tue 08 Oct 2019 11:51

Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by KRU » Thu 23 Jan 2020 09:32

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by Shalex » Fri 24 Jan 2020 19:03

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.

KRU
Posts: 5
Joined: Tue 08 Oct 2019 11:51

Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by KRU » Thu 06 Feb 2020 08:12

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by Shalex » Mon 10 Feb 2020 17:59

We have reproduced the issue and will notify you when it is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Can't configure column to be AS IDENTITY? (EF Core 2.2.4))

Post by Shalex » Mon 02 Mar 2020 15:38

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.

Post Reply