wip
This commit is contained in:
parent
1ecaf64dea
commit
cb9d5e332e
11 changed files with 72 additions and 69 deletions
|
@ -0,0 +1,8 @@
|
|||
using Femto.Modules.Authentication.Data;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Femto.Modules.Authentication.Application;
|
||||
|
||||
internal class AuthenticationModule(IHost host) : IAuthenticationModule
|
||||
{
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
using Femto.Common.Infrastructure.Outbox;
|
||||
using Femto.Modules.Authentication.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Femto.Modules.Authentication.Application;
|
||||
|
||||
public static class AuthenticationStartup
|
||||
{
|
||||
public static void InitializeAuthenticationModule(this IServiceCollection rootContainer, string connectionString)
|
||||
{
|
||||
var hostBuilder = Host.CreateDefaultBuilder();
|
||||
hostBuilder.ConfigureServices(services => ConfigureServices(services, connectionString));
|
||||
|
||||
var host = hostBuilder.Build();
|
||||
|
||||
rootContainer.AddScoped<IAuthenticationModule>(_ => new AuthenticationModule(host));
|
||||
}
|
||||
|
||||
private static void ConfigureServices(IServiceCollection services, string connectionString)
|
||||
{
|
||||
services.AddDbContext<AuthenticationContext>(
|
||||
builder =>
|
||||
{
|
||||
builder.UseNpgsql(connectionString);
|
||||
builder.UseSnakeCaseNamingConvention();
|
||||
});
|
||||
|
||||
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthenticationStartup).Assembly));
|
||||
|
||||
services.AddDbContext<AuthenticationContext>(builder =>
|
||||
{
|
||||
builder.UseNpgsql();
|
||||
builder.UseSnakeCaseNamingConvention();
|
||||
builder.EnableSensitiveDataLogging();
|
||||
});
|
||||
|
||||
services.AddMediatR(c =>
|
||||
{
|
||||
c.RegisterServicesFromAssembly(typeof(AuthenticationStartup).Assembly);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
namespace Femto.Modules.Authentication.Application;
|
||||
|
||||
public interface IAuthenticationModule
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue