1
我正在使用(评估:))亚音速ActiveRecord模式访问sqLite。需要交易才能工作。定期的东西... ocurse!将生成的ID从表1(主键)传递到表2(外键)?
以下片段解释了所需的逻辑。我无法在文档中找到正确的示例。
using (TransactionScope ts = new TransactionScope())
{
using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope())
{
// insert data in table 1 with primary key column. Save the id returned for later use.
// insert data in table 2 with a foreign key column. Use the Id generated in table 1.
// ts.commit here
}
}
请指教。由于