Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
linq to sql を使用して挿入を行った後、テーブルに ID 列がある場合、Identity_scope 値を取得できますか?
Linq to SQL は、SubmitChangesメソッドが呼び出された直後に使用可能な ID 値を処理します。
SubmitChanges
var entity = new Entity(); // ... ctx.Entities.InsertOnSubmit(entity); ctx.SubmitChanges(); // Here you can use the generated value of yout identity column entity.Id;