Page 1 of 1

Entity Framework4, after insert POCO object, entitykey not updated

Posted: Wed 08 Dec 2010 10:11
by leishen
I'm using "dotConnect for Oracle Professional 5.70.180.0" to connect Oracle10g database, after I created edmx file using VS2010, I execute:

Code: Select all

class Person
{
    public string Name {get;set;}
    public decimal Id {get;set;} // EntityKey
}
...

Person p = new Person{Name="Test"};

...
using(PersonContext context = new PersonContext())
{
    context.Persons.AddObject(p);
    context.SaveChanges();
}
After this, I check person.Id, it was still 0, although in database, it was 999. Why entitykey not retrieved from database?

Posted: Wed 08 Dec 2010 13:35
by leishen