Browse Source

Change UOW Timeout property type to int?.

Resolve #4355
pull/4363/head
maliming 6 years ago
parent
commit
1ce6f8cdcf
  1. 6
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
  2. 6
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs
  3. 8
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs
  4. 4
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IAbpUnitOfWorkOptions.cs
  5. 6
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkAttribute.cs
  6. 8
      framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs

6
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs

@ -118,7 +118,7 @@ namespace Volo.Abp.EntityFrameworkCore
modelBuilder.SetDatabaseProvider(provider.Value);
}
}
protected virtual EfCoreDatabaseProvider? GetDatabaseProviderOrNull(ModelBuilder modelBuilder)
{
switch (Database.ProviderName)
@ -187,7 +187,7 @@ namespace Volo.Abp.EntityFrameworkCore
Database.IsRelational() &&
!Database.GetCommandTimeout().HasValue)
{
Database.SetCommandTimeout(initializationContext.UnitOfWork.Options.Timeout.Value.TotalSeconds.To<int>());
Database.SetCommandTimeout(initializationContext.UnitOfWork.Options.Timeout.Value);
}
ChangeTracker.CascadeDeleteTiming = CascadeTiming.OnSaveChanges;
@ -627,4 +627,4 @@ namespace Volo.Abp.EntityFrameworkCore
}
}
}
}
}

6
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs

@ -4,7 +4,7 @@ using System.Data;
namespace Volo.Abp.Uow
{
//TODO: Implement default options!
/// <summary>
/// Global (default) unit of work options
/// </summary>
@ -17,7 +17,7 @@ namespace Volo.Abp.Uow
public IsolationLevel? IsolationLevel { get; set; }
public TimeSpan? Timeout { get; set; }
public int? Timeout { get; set; }
internal AbpUnitOfWorkOptions Normalize(AbpUnitOfWorkOptions options)
{
@ -49,4 +49,4 @@ namespace Volo.Abp.Uow
}
}
}
}
}

8
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs

@ -12,14 +12,14 @@ namespace Volo.Abp.Uow
public IsolationLevel? IsolationLevel { get; set; }
public TimeSpan? Timeout { get; set; }
public int? Timeout { get; set; }
public AbpUnitOfWorkOptions()
{
}
public AbpUnitOfWorkOptions(bool isTransactional = false, IsolationLevel? isolationLevel = null, TimeSpan? timeout = null)
public AbpUnitOfWorkOptions(bool isTransactional = false, IsolationLevel? isolationLevel = null, int? timeout = null)
{
IsTransactional = isTransactional;
IsolationLevel = isolationLevel;
@ -36,4 +36,4 @@ namespace Volo.Abp.Uow
};
}
}
}
}

4
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IAbpUnitOfWorkOptions.cs

@ -9,6 +9,6 @@ namespace Volo.Abp.Uow
IsolationLevel? IsolationLevel { get; }
TimeSpan? Timeout { get; }
int? Timeout { get; }
}
}
}

6
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkAttribute.cs

@ -22,7 +22,7 @@ namespace Volo.Abp.Uow
/// Timeout of UOW As milliseconds.
/// Uses default value if not supplied.
/// </summary>
public TimeSpan? Timeout { get; set; }
public int? Timeout { get; set; }
/// <summary>
/// If this UOW is transactional, this option indicated the isolation level of the transaction.
@ -39,7 +39,7 @@ namespace Volo.Abp.Uow
public UnitOfWorkAttribute()
{
}
public UnitOfWorkAttribute(bool isTransactional)
@ -53,7 +53,7 @@ namespace Volo.Abp.Uow
IsolationLevel = isolationLevel;
}
public UnitOfWorkAttribute(bool isTransactional, IsolationLevel isolationLevel, TimeSpan timeout)
public UnitOfWorkAttribute(bool isTransactional, IsolationLevel isolationLevel, int timeout)
{
IsTransactional = isTransactional;
IsolationLevel = isolationLevel;

8
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs

@ -8,11 +8,11 @@ namespace Volo.Abp.Uow
{
[NotNull]
public static IUnitOfWork Begin(
[NotNull] this IUnitOfWorkManager unitOfWorkManager,
[NotNull] this IUnitOfWorkManager unitOfWorkManager,
bool requiresNew = false,
bool isTransactional = false,
IsolationLevel? isolationLevel = null,
TimeSpan? timeout = null)
IsolationLevel? isolationLevel = null,
int? timeout = null)
{
Check.NotNull(unitOfWorkManager, nameof(unitOfWorkManager));
@ -40,4 +40,4 @@ namespace Volo.Abp.Uow
unitOfWorkManager.TryBeginReserved(reservationName, new AbpUnitOfWorkOptions());
}
}
}
}

Loading…
Cancel
Save