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;
source share