Browse Source
Merge pull request #4363 from abpframework/maliming/UnitOfWorkAttribute
Change UOW Timeout property type to int?.
pull/4453/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
25 additions and
19 deletions
-
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
-
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs
-
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs
-
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IAbpUnitOfWorkOptions.cs
-
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkAttribute.cs
-
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.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(TimeSpan.FromMilliseconds(initializationContext.UnitOfWork.Options.Timeout.Value)); |
|
|
|
} |
|
|
|
|
|
|
|
ChangeTracker.CascadeDeleteTiming = CascadeTiming.OnSaveChanges; |
|
|
|
@ -627,4 +627,4 @@ namespace Volo.Abp.EntityFrameworkCore |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -12,14 +12,17 @@ namespace Volo.Abp.Uow |
|
|
|
|
|
|
|
public IsolationLevel? IsolationLevel { get; set; } |
|
|
|
|
|
|
|
public TimeSpan? Timeout { get; set; } |
|
|
|
/// <summary>
|
|
|
|
/// Milliseconds
|
|
|
|
/// </summary>
|
|
|
|
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 +39,4 @@ namespace Volo.Abp.Uow |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -9,6 +9,9 @@ namespace Volo.Abp.Uow |
|
|
|
|
|
|
|
IsolationLevel? IsolationLevel { get; } |
|
|
|
|
|
|
|
TimeSpan? Timeout { get; } |
|
|
|
/// <summary>
|
|
|
|
/// Milliseconds
|
|
|
|
/// </summary>
|
|
|
|
int? Timeout { get; } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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,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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|