using BotSharp.Plugin.MongoStorage.Repository; namespace BotSharp.Plugin.MongoStorage; /// /// MongoDB as the repository /// public class MongoStoragePlugin : IBotSharpPlugin { public void RegisterDI(IServiceCollection services, IConfiguration config) { var dbSettings = new BotSharpDatabaseSettings(); config.Bind("Database", dbSettings); if (dbSettings.Default == "MongoRepository") { services.AddScoped((IServiceProvider x) => { var dbSettings = x.GetRequiredService(); return new MongoDbContext(dbSettings); }); services.AddScoped(); } } }