forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfiledDbTransaction.cs
More file actions
55 lines (44 loc) · 1.41 KB
/
ProfiledDbTransaction.cs
File metadata and controls
55 lines (44 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Data.Common;
using System.Data;
using ServiceStack.Data;
#pragma warning disable 1591 // xml doc comments warnings
namespace ServiceStack.MiniProfiler.Data
{
public class ProfiledDbTransaction : DbTransaction, IHasDbTransaction
{
private ProfiledConnection db;
private DbTransaction trans;
public ProfiledDbTransaction(DbTransaction transaction, ProfiledConnection connection)
{
if (transaction == null)
throw new ArgumentNullException(nameof(transaction));
if (connection == null)
throw new ArgumentNullException(nameof(connection));
this.trans = transaction;
this.db = connection;
}
protected override DbConnection DbConnection => db;
public IDbTransaction DbTransaction => trans;
public override IsolationLevel IsolationLevel => trans.IsolationLevel;
public override void Commit()
{
trans.Commit();
}
public override void Rollback()
{
trans.Rollback();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
trans?.Dispose();
}
trans = null;
db = null;
base.Dispose(disposing);
}
}
}
#pragma warning restore 1591 // xml doc comments warnings