hopefully not a horribly foolish refactoring
This commit is contained in:
parent
59d660165f
commit
1ecaf64dea
82 changed files with 782 additions and 398 deletions
57
Femto.Modules.Authentication/Module.cs
Normal file
57
Femto.Modules.Authentication/Module.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using Femto.Common.Infrastructure.Outbox;
|
||||
using Femto.Modules.Authentication.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Femto.Modules.Authentication;
|
||||
|
||||
public static class Module
|
||||
{
|
||||
public static void UseIdentityModule(this IServiceCollection services, string connectionString)
|
||||
{
|
||||
services.AddDbContext<AuthenticationContext>(
|
||||
builder =>
|
||||
{
|
||||
builder.UseNpgsql(connectionString);
|
||||
builder.UseSnakeCaseNamingConvention();
|
||||
});
|
||||
|
||||
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(Module).Assembly));
|
||||
|
||||
services.AddDbContext<AuthenticationContext>(builder =>
|
||||
{
|
||||
builder.UseNpgsql(
|
||||
connectionString,
|
||||
o =>
|
||||
{
|
||||
o.MapEnum<OutboxEntryStatus>("outbox_status");
|
||||
}
|
||||
);
|
||||
|
||||
builder.UseSnakeCaseNamingConvention();
|
||||
|
||||
var loggerFactory = LoggerFactory.Create(b =>
|
||||
{
|
||||
// b.AddConsole();
|
||||
// .AddFilter(
|
||||
// (category, level) =>
|
||||
// category == DbLoggerCategory.Database.Command.Name
|
||||
// && level == LogLevel.Debug
|
||||
// );
|
||||
});
|
||||
|
||||
builder.UseLoggerFactory(loggerFactory);
|
||||
builder.EnableSensitiveDataLogging();
|
||||
});
|
||||
|
||||
// services.AddOutbox<AuthenticationContext>();
|
||||
|
||||
services.AddMediatR(c =>
|
||||
{
|
||||
c.RegisterServicesFromAssembly(typeof(Module).Assembly);
|
||||
});
|
||||
|
||||
services.AddTransient<Outbox<AuthenticationContext>, Outbox<AuthenticationContext>>();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue