Files
social-media/backend/src/Web/Features/Contents/DependencyInjection.cs

20 lines
693 B
C#

using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Contents.Handlers;
namespace Hutopy.Web.Features.Contents;
public static class DependencyInjection
{
public static WebApplicationBuilder AddContentModule(
this WebApplicationBuilder builder,
Action<DbContextOptionsBuilder>? configureAction = null)
{
builder.Services.AddDbContext<ContentDbContext>(configureAction);
builder.Services.AddScoped<ContentDbContextInitializer>();
builder.Services.Configure<ContentOptions>(builder.Configuration.GetSection(ContentOptions.ConfigurationSection));
builder.Services.AddScoped<SlugPurger>();
return builder;
}
}