refresh user

This commit is contained in:
john 2025-05-19 09:23:20 +02:00
parent 4e24796a5d
commit 0d34774059
12 changed files with 141 additions and 32 deletions

View file

@ -21,7 +21,12 @@ public static class AuthStartup
var hostBuilder = Host.CreateDefaultBuilder();
hostBuilder.ConfigureServices(services => ConfigureServices(services, connectionString, eventBus));
var host = hostBuilder.Build();
rootContainer.AddScoped<IAuthModule>(_ => new AuthModule(host));
rootContainer.AddScoped(_ => new ScopeBinding(host.Services.CreateScope()));
rootContainer.AddScoped<IAuthModule>(services =>
services.GetRequiredService<ScopeBinding>().GetService<IAuthModule>());
rootContainer.AddHostedService(services => new AuthApplication(host));
eventBus.Subscribe((evt, cancellationToken) => EventSubscriber(evt, host.Services, cancellationToken));
}
@ -50,11 +55,11 @@ public static class AuthStartup
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthStartup).Assembly));
services.ConfigureDomainServices<AuthContext>();
services.AddSingleton(publisher);
services.AddScoped<IAuthModule, AuthModule>();
}
private static async Task EventSubscriber(