-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathTransactionScopeOptions.cs
More file actions
38 lines (33 loc) · 1.14 KB
/
TransactionScopeOptions.cs
File metadata and controls
38 lines (33 loc) · 1.14 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
namespace NServiceBus
{
using System;
using System.Transactions;
/// <summary>
/// SQL Transport TransactionScope options.
/// </summary>
public class TransactionScopeOptions
{
internal TransactionScopeOptions() { }
/// <summary>
/// Transaction timeout.
/// </summary>
public TimeSpan Timeout
{
get;
set
{
if (value > TransactionManager.MaximumTimeout)
{
var message = "Timeout requested is longer than the maximum value for this machine. Override using the maxTimeout setting of the system.transactions section in machine.config";
throw new Exception(message);
}
field = value;
}
} = TransactionManager.DefaultTimeout;
/// <summary>
/// Transaction isolation level.
/// </summary>
public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;
internal TransactionOptions TransactionOptions => new() { IsolationLevel = IsolationLevel, Timeout = Timeout };
}
}