EntityFramework with Sequence

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
JoeRuspante
Posts: 54
Joined: Mon 05 Jul 2010 23:08

EntityFramework with Sequence

Post by JoeRuspante » Wed 08 Dec 2010 22:05

Hi everybody.

I'm using the new version of the DotConnect (6.0.58)
I have a simple table (MyTable) with two fields:

ID -> Integer (sequence)
NAME -> String

If I use the EntityFramework and I use this code:

Code: Select all

Context ctx = new Context();

MyTable t = new MyTable();
t.NAME = "Test";

ctx.MyTables.Add(t);
ctx.SaveChanges();

Console.Writeline(t.ID);


After the "SaveChanges", the ID is still 0 (zero). Why doesn't EntityFramework load it?
If I look into the DB, the new value is saved and the ID is se correclty (the first time, on the Oracle DB there is a single row with ID equals 1 and NAME is Test.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 09 Dec 2010 14:58

Please make sure that you have set the StoredGeneratedPattern attribute in the Store part of the model to "Identity".
This issue was already discussed here.

dimsavva
Posts: 1
Joined: Mon 13 Dec 2010 14:05

Post by dimsavva » Mon 13 Dec 2010 14:59

Hi,

I have the exact same problem.
I have made sure that StoredGeneratedPattern is set to identity.
The value for the ID does get generated in the db, but still returns 0;

I am using VS 2010, EF4. I have also tried this using the devart entity developer, same issue.

Really stuck here, please help.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 13 Dec 2010 15:33

Please make sure that the StoreGeneratedPattern attribute is set in the Store part of the model. If it is in place, please send us (support * devart * com, subject "EF Identity") a small test project (or at least the model file) reproducing the error.

JoeRuspante
Posts: 54
Joined: Mon 05 Jul 2010 23:08

Hi.

Post by JoeRuspante » Wed 19 Jan 2011 23:15

I sent to you the example about a mounth ago, but I don't see any reply.
There are any news?

(I Re-send the same email today, so you can look at it)

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 20 Jan 2011 16:48

I have set the StoreGeneratedPattern attribute in the Store part of the model and your project worked correctly.
I have sent the corrected project back.

Post Reply