This commit is contained in:
john 2025-05-16 16:10:01 +02:00
parent 14fd359ea8
commit a4ef2b4a20
26 changed files with 331 additions and 78 deletions

View file

@ -8,7 +8,7 @@ using Microsoft.Extensions.Hosting;
namespace Femto.Modules.Media.Application;
public static class Startup
public static class MediaStartup
{
public static void InitializeMediaModule(this IServiceCollection rootContainer, string connectionString, string storageRoot)
{
@ -22,16 +22,13 @@ public static class Startup
builder.UseSnakeCaseNamingConvention();
});
services.AddTransient<IStorageProvider>(s => new FilesystemStorageProvider(storageRoot));
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(Startup).Assembly));
services.AddTransient(
typeof(IPipelineBehavior<,>),
typeof(SaveChangesPipelineBehaviour<,>)
);
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(MediaStartup).Assembly));
services.ConfigureDomainServices<MediaContext>();
});
var host = hostBuilder.Build();
rootContainer.AddTransient<IMediaModule>(_ => new MediaModule(host));
rootContainer.AddHostedService(services => new MediaApplication(host));
}
}