Page 1 of 1

devart:DefaultValue not working in version 9.7

Posted: Mon 18 May 2020 08:11
by a199
We've been using the solution described here:
https://blog.devart.com/set-identity-an ... ggers.html
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)

for 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:

Code: Select all

<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:

Code: Select all

ctx.TABLEs.AddObject(new TABLE(){COL1 = "a", COL2 = 3});
ctx.SaveChanges();
When I execute the code in a console application, the command generated is:

Code: Select all

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:

Code: Select all

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?

Re: devart:DefaultValue not working in version 9.7

Posted: Mon 18 May 2020 14:03
by a199
Eventually I found it...
The Web Application was old and used the dll - Devart.Data.Oracle.Entity.EF4
After changing in the model (Model Settings) the Entity Framework Version to be 5, and replacing the dll to Devart.Data.Oracle.Entity.EF5 in my program, it started to work again.