using System; using System.Collections.Generic; using System.Text; using System.Transactions; namespace DG.EntityFramework { /// /// Unit of work options. /// public class UnitOfWorkOptions { /// /// Creates a new UnitOfWorkOptions object. /// public UnitOfWorkOptions() { IsTransactional = true; Scope = TransactionScopeOption.Required; Timeout = TimeSpan.FromMinutes(2); IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; } /// /// Scope option. /// public TransactionScopeOption? Scope { get; set; } /// /// Is this Unit of work transactional? Uses default value if not supplied. /// public bool? IsTransactional { get; set; } /// /// Timeout of Unit of work As milliseconds. Uses default value if not supplied. /// public TimeSpan? Timeout { get; set; } /// /// If this Unit of work is transactional, this option indicated the isolation level of the transaction. Uses default value if not supplied. /// public IsolationLevel? IsolationLevel { get; set; } /// /// This option should be set to System.Transactions.TransactionScopeAsyncFlowOption.Enabled if unit of work is used in an async scope. /// public TransactionScopeAsyncFlowOption? AsyncFlowOption { get; set; } } }