devart:DefaultValue not working in version 9.7

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
a199
Posts: 2
Joined: Mon 18 May 2020 08:02

devart:DefaultValue not working in version 9.7

Post by a199 » Mon 18 May 2020 08:11

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?

a199
Posts: 2
Joined: Mon 18 May 2020 08:02

Re: devart:DefaultValue not working in version 9.7

Post by a199 » Mon 18 May 2020 14:03

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.

Post Reply