Browse Source
Set `isolationLevel` to `Serializable ` for `Delete` methods.
pull/19133/head
maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
4 changed files with
9 additions and
6 deletions
-
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreOptions.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/AbpOpenIddictApplicationStore.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Authorizations/AbpOpenIddictAuthorizationStore.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Tokens/AbpOpenIddictTokenStore.cs
|
|
|
@ -4,10 +4,13 @@ namespace Volo.Abp.OpenIddict; |
|
|
|
|
|
|
|
public class AbpOpenIddictStoreOptions |
|
|
|
{ |
|
|
|
public IsolationLevel? DefaultIsolationLevel { get; set; } |
|
|
|
public IsolationLevel? PruneIsolationLevel { get; set; } |
|
|
|
|
|
|
|
public IsolationLevel? DeleteIsolationLevel { get; set; } |
|
|
|
|
|
|
|
public AbpOpenIddictStoreOptions() |
|
|
|
{ |
|
|
|
DefaultIsolationLevel = IsolationLevel.RepeatableRead; |
|
|
|
PruneIsolationLevel = IsolationLevel.RepeatableRead; |
|
|
|
DeleteIsolationLevel = IsolationLevel.Serializable; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -61,7 +61,7 @@ public class AbpOpenIddictApplicationStore : AbpOpenIddictStoreBase<IOpenIddictA |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.DefaultIsolationLevel)) |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.DeleteIsolationLevel)) |
|
|
|
{ |
|
|
|
await TokenRepository.DeleteManyByApplicationIdAsync(application.Id, cancellationToken: cancellationToken); |
|
|
|
|
|
|
|
|
|
|
|
@ -63,7 +63,7 @@ public class AbpOpenIddictAuthorizationStore : AbpOpenIddictStoreBase<IOpenIddic |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.DefaultIsolationLevel)) |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.DeleteIsolationLevel)) |
|
|
|
{ |
|
|
|
await TokenRepository.DeleteManyByAuthorizationIdAsync(authorization.Id, cancellationToken: cancellationToken); |
|
|
|
|
|
|
|
@ -291,7 +291,7 @@ public class AbpOpenIddictAuthorizationStore : AbpOpenIddictStoreBase<IOpenIddic |
|
|
|
|
|
|
|
public virtual async ValueTask<long> PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.DefaultIsolationLevel)) |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.PruneIsolationLevel)) |
|
|
|
{ |
|
|
|
var date = threshold.UtcDateTime; |
|
|
|
var count = await Repository.PruneAsync(date, cancellationToken: cancellationToken); |
|
|
|
|
|
|
|
@ -311,7 +311,7 @@ public class AbpOpenIddictTokenStore : AbpOpenIddictStoreBase<IOpenIddictTokenRe |
|
|
|
|
|
|
|
public virtual async ValueTask<long> PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.DefaultIsolationLevel)) |
|
|
|
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true, isolationLevel: StoreOptions.Value.PruneIsolationLevel)) |
|
|
|
{ |
|
|
|
var date = threshold.UtcDateTime; |
|
|
|
var count = await Repository.PruneAsync(date, cancellationToken: cancellationToken); |
|
|
|
|