Reputation: 304
I am beginner to Entity Framework.
Let's say I have a Person Entity and I need to add a new Person to Database.
My Database has a Person Table with Id, Name, Age, and email. where id is the PK.
To add a new Person. My code will look:
DatabaseEntities context = new DatabaseEntities();
Person p = new Person("name", age, "email");
context.AddToPersons(p);
context.SaveChanges();
My Question is: After adding the new person, How can I get the id of that person.
Upvotes: 0
Views: 515