namespace Knot.Modules.Profiles; public static class DependencyInjection { public static IServiceCollection AddProfilesModule(this IServiceCollection services, IConfiguration configuration) { services.AddScoped(); services.AddScoped(); services.AddScoped(); // MongoDB Registration var mongoConnection = configuration.GetConnectionString("MongoConnection") ?? configuration["MONGO_URL"] ?? "mongodb://localhost:27017"; var mongoClient = new MongoClient(mongoConnection); var database = mongoClient.GetDatabase("knot_messager"); services.AddSingleton(database); services.AddMediatR(config => config.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly)); return services; } }