diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs index dd396129216..a8f3f75a11e 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs @@ -14,6 +14,18 @@ public class AbpUnitOfWorkOptions : IAbpUnitOfWorkOptions public TimeSpan? Timeout { get; set; } + public AbpUnitOfWorkOptions() + { + + } + + public AbpUnitOfWorkOptions(bool isTransactional = false, IsolationLevel? isolationLevel = null, TimeSpan? timeout = null) + { + IsTransactional = isTransactional; + IsolationLevel = isolationLevel; + Timeout = timeout; + } + public AbpUnitOfWorkOptions Clone() { return new AbpUnitOfWorkOptions diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs index bf8859d6ac3..a0c52a49f47 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs @@ -1,15 +1,27 @@ -using JetBrains.Annotations; +using System; +using System.Data; +using JetBrains.Annotations; namespace Volo.Abp.Uow { public static class UnitOfWorkManagerExtensions { [NotNull] - public static IUnitOfWork Begin([NotNull] this IUnitOfWorkManager unitOfWorkManager, bool requiresNew = false) + public static IUnitOfWork Begin( + [NotNull] this IUnitOfWorkManager unitOfWorkManager, + bool requiresNew = false, + bool isTransactional = false, + IsolationLevel? isolationLevel = null, + TimeSpan? timeout = null) { Check.NotNull(unitOfWorkManager, nameof(unitOfWorkManager)); - return unitOfWorkManager.Begin(new AbpUnitOfWorkOptions(), requiresNew); + return unitOfWorkManager.Begin(new AbpUnitOfWorkOptions + { + IsTransactional = isTransactional, + IsolationLevel = isolationLevel, + Timeout = timeout + }, requiresNew); } public static void BeginReserved([NotNull] this IUnitOfWorkManager unitOfWorkManager, [NotNull] string reservationName)