using BotSharp.Plugin.MongoStorage.Repository; namespace BotSharp.Plugin.MongoStorage; public class MongoStoragePlugin : IBotSharpPlugin { public void RegisterDI(IServiceCollection services, IConfiguration config) { var sp = services.BuildServiceProvider(); var dbSettings = sp.GetRequiredService(); if (dbSettings.Default == "MongoRepository") { services.AddScoped((IServiceProvider x) => { var dbSettings = x.GetRequiredService(); return new MongoDbContext(dbSettings.MongoDb); }); services.AddScoped(); } } }