|
1
1
尝试将SqlConnection放置在TransactionScope中,然后它会自动登记到事务中。
http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx 抱歉,刚才抓到了您的操作-可能是因为连接没有配置为自动登记到现有事务中(我认为是连接字符串的一个成员)。
当然,在当前的代码示例中,您可以安全地使用SqlTransaction对象,因为您不涉及多个连接/数据库。 |
|
|
2
2
|
|
|
3
0
|
|
Anyname Donotcare · EF中的连通模型和非连通模型 11 年前 |