I am trying to insert multiple objects into my db.
foreach (employee employeedata in employeelist)
{ objectcontext.employees.AddObject(employeedata); } objectcontext.SaveChanges();
I call objectcontext.savechanges outside the loop so that it is efficient. The problem is that I would like to get a list of primary keys that are generated by the db.
If I am inserting a single object using objectcontext.employees.AddObject(employeeA) I could get the id after saving changes as employeeA.id. I am not sure of how to go about this now that I am adding a list of objects to the object context and then calling savechanges that inserts these into the db. Am I missing something obvious here? Thanks,