Linq to Sql: can I return Identity_Scope after insertion?

After I insert linq in sql, can I return the value of Identity_scope if there is an identifier column in my table?

+4
source share
1 answer

Linq to SQL does the job for you, the identifier value, which is available immediately after calling the SubmitChanges method.

 var entity = new Entity(); // ... ctx.Entities.InsertOnSubmit(entity); ctx.SubmitChanges(); // Here you can use the generated value of yout identity column entity.Id; 
+6
source

All Articles