TransactionScope
まだダメ~ (Core 2.0)
dotnet Conf 関西 2017
2017/10/14 SQLWorld お だ
自己紹介
織田 信亮(おだ しんすけ)
大阪で開発者しています
SQLWorld の代表です
http://odashinsuke.hatenablog.com/
Twitter:@shinsukeoda
TransactionScope
System.Transactions.TransactionScope
便利なやつ
.NET Framework 2.0 から追加
同じ接続文字列なら分散トランザクション
にならない 等だんだん便利に
※SQL Server 相手の話し
有るとき~
public void 便利なの() {
using (var tran = new TransactionScope())
using (var conn = new SqlConnection(connstr)) {
conn.Open();
// 更新処理
tran.Complete();
}
}
無いとき~
public void 普通の() {
using (var conn = new SqlConnection(connstr)) {
conn.Open();
using (var tran = conn.BeginTransaction()) {
try {
// 更新処理
tran.Commit();
} catch (Exception) {
tran.Rollback();
throw;
}
}
}
}
.NET Core では?
1.0, 1.1 では 無い
2.0 から System.Transactions が追加
Core 2.1 では直るらしい…
https://github.com/dotnet/corefx/issu
es/12534
https://github.com/dotnet/corefx/issu
es/24282
SqlClient 4.5.0 で直りそう
SqlClient 4.5.0 でも直りそう
Nuget の闇
Nuget の闇
Transaction scopeまだダメ

Transaction scopeまだダメ