4 Commits

2 changed files with 4 additions and 6 deletions
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using NexusReader.Domain.Entities;
using NexusReader.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
namespace NexusReader.Infrastructure.Identity;
@@ -12,12 +11,12 @@ namespace NexusReader.Infrastructure.Identity;
/// </summary>
public class TokenLimitHandler : AuthorizationHandler<TokenLimitRequirement>
{
private readonly IDbContextFactory<AppDbContext> _dbContextFactory;
private readonly AppDbContext _dbContext;
private readonly UserManager<NexusUser> _userManager;
public TokenLimitHandler(IDbContextFactory<AppDbContext> dbContextFactory, UserManager<NexusUser> userManager)
public TokenLimitHandler(AppDbContext dbContext, UserManager<NexusUser> userManager)
{
_dbContextFactory = dbContextFactory;
_dbContext = dbContext;
_userManager = userManager;
}
+1 -2
View File
@@ -135,8 +135,7 @@ using (var scope = app.Services.CreateScope())
{
var services = scope.ServiceProvider;
var logger = services.GetRequiredService<ILogger<Program>>();
var dbContextFactory = services.GetRequiredService<IDbContextFactory<NexusReader.Infrastructure.Persistence.AppDbContext>>();
using var dbContext = await dbContextFactory.CreateDbContextAsync();
var dbContext = services.GetRequiredService<NexusReader.Infrastructure.Persistence.AppDbContext>();
int maxRetries = 5;
int delayMs = 2000;