Resolved #2558: Add options to IUnitOfWorkManager.Begin().

pull/2566/head
Halil İbrahim Kalkan 5 years ago
parent 787dd43e39
commit db1cd57787

@ -14,6 +14,18 @@ namespace Volo.Abp.Uow
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

@ -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)

Loading…
Cancel
Save