0

We're using Devart dotConnect for oracle with Entitiy Framework.

We've been using the solution described here to generate IDs with sequences and all worked well, untill we upgraded to devart 9.7

It looks as if the DefaultValue is being ignored. For Example, if I look in the DBMonitor I see the insert command without the seq_name.nextval.

The strange thing is that when I run the same code in a console application it works, but on IIS not (even on the same machine)

Edit: example:

There is a table MY_TABLE and a sequence MY_SEQUENCE in an oracle db.

I used the Devart Entity Developer to generate an edml model containing one entity for that table, it's called TABLE.

In the XML Editor I added the DefaultValue and the StoreGeneratedPattern attributes. it looks like this:

<EntityType Name="MY_TABLE">
      <Key>
        <PropertyRef Name="ID" />
      </Key>
      <Property Name="ID" Type="decimal" Nullable="false"                     
                devart:DefaultValue="MY_SEQUENCE.nextval"
                StoreGeneratedPattern="Identity" />
      <Property Name="COL1" Type="VARCHAR2" MaxLength="200" />
      <Property Name="COL2" Type="decimal" Nullable="false" />
    </EntityType>

In my c# code it looks like this:

ctx.TABLEs.AddObject(new TABLE(){COL1 = "a", COL2 = 3});
ctx.SaveChanges();

When I execute the code in a console application, the command generated is:

DECLARE
  updatedRowid ROWID;
BEGIN
INSERT INTO MY_TABLE(ID, COL1, COL2)
VALUES (MY_SEQUENCES.nextval, :p0, :p1)
RETURNING ROWID INTO updatedRowid;
OPEN :outParameter FOR SELECT ID FROM MY_TABLE WHERE ROWID = updatedRowid;
END;

But, the same code on IIS (on the same machine) generates this command:

DECLARE
  updatedRowid ROWID;
BEGIN
INSERT INTO MY_TABLE(COL1, COL2)
VALUES (:p0, :p1)
RETURNING ROWID INTO updatedRowid;
OPEN :outParameter FOR SELECT ID FROM MY_TABLE WHERE ROWID = updatedRowid;
END;

In old Devart versions (before 9.7) it worked well.

What may be the cause?

1 Answers1

0

After moving to Entity Framework Version 5, and replacing the dll - Devart.Data.Oracle.Entity.EF4 with Devart.Data.Oracle.Entity.EF5, it started to work again.