mirror of https://github.com/abpframework/abp.git
committed by
GitHub
8 changed files with 69 additions and 9 deletions
@ -0,0 +1,9 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace Volo.Abp.OpenIddict; |
|||
|
|||
public interface IOpenIddictDbConcurrencyExceptionHandler |
|||
{ |
|||
Task HandleAsync(AbpDbConcurrencyException exception); |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.OpenIddict; |
|||
|
|||
public class EfCoreOpenIddictDbConcurrencyExceptionHandler : IOpenIddictDbConcurrencyExceptionHandler, ITransientDependency |
|||
{ |
|||
public virtual Task HandleAsync(AbpDbConcurrencyException exception) |
|||
{ |
|||
if (exception != null && |
|||
exception.InnerException is DbUpdateConcurrencyException updateConcurrencyException) |
|||
{ |
|||
foreach (var entry in updateConcurrencyException.Entries) |
|||
{ |
|||
// Reset the state of the entity to prevents future calls to SaveChangesAsync() from failing.
|
|||
entry.State = EntityState.Unchanged; |
|||
} |
|||
} |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.OpenIddict; |
|||
|
|||
public class MongoOpenIddictDbConcurrencyExceptionHandler: IOpenIddictDbConcurrencyExceptionHandler, ITransientDependency |
|||
{ |
|||
public virtual Task HandleAsync(AbpDbConcurrencyException exception) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue