データベースへのアクセスには、Rob Conery のMassiveを使用しています。いくつかの挿入でトランザクションをラップしたいのですが、2 番目の挿入は最初の挿入から返された ID を使用します。トランザクションでこれを行う方法は私には明らかではありません。いくつかの支援をいただければ幸いです。
var commandList = new List<DbCommand>
{
contactTbl.CreateInsertCommand(new
{
newContact.Name,
newContact.Contact,
newContact.Phone,
newContact.ForceChargeThreshold,
newContact.MeterReadingMethodId,
LastModifiedBy = userId,
LastModifiedDate = modifiedDate,
}),
branchContactTbl.CreateInsertCommand(new
{
newContact.BranchId,
ContactId = ????, <-- how to set Id as identity from previous command
}),
};