devart:DefaultValue not working in version 9.7
Posted: 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:
In my c# code it looks like this:
When I execute the code in a console application, the command generated is:
But, the same code on IIS (on the same machine) generates this command:
In old Devart versions (before 9.7) it worked well.
What may be the cause?
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>
Code: Select all
ctx.TABLEs.AddObject(new TABLE(){COL1 = "a", COL2 = 3});
ctx.SaveChanges();
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;
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;
What may be the cause?