EF Core with Oracle 11g. Problem with IDENTITY PK

Viewed 1610

The project is runnig with .Net Core 2.2, EF Core and SQL Server. Now, I need to use this same projetc with Oracle 11g. I create a new Migration project with Oracle.ManagedDataAccess.Core. The migration file generated is below:

migrationBuilder.CreateTable(
                name: "AREAATUACAO",
                schema: "SISDETEC",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    DATACADASTRO = table.Column<DateTime>(nullable: false),
                    DATAATUALIZACAO = table.Column<DateTime>(nullable: false),
                    NOME = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AREAATUACAO", x => x.ID);
                });

And the script generated is:

BEGIN 
EXECUTE IMMEDIATE 'CREATE TABLE 
"SISDETEC"."AREAATUACAO" (
    "ID" NUMBER(19) GENERATED BY DEFAULT ON NULL AS IDENTITY NOT NULL,
    "DATACADASTRO" TIMESTAMP(7) NOT NULL,
    "DATAATUALIZACAO" TIMESTAMP(7) NOT NULL,
    "NOME" NVARCHAR2(2000),
    CONSTRAINT "PK_AREAATUACAO" PRIMARY KEY ("ID")
)';
END;

But, in the Oracle 11g do not exists the IDENTITY command. The PKs must be generated with a trigger and a sequence.

How can I config de EF Core to generate commands for Oracle version 11g?

1 Answers
Related