public static IServiceCollection AddProfiledMongoDb(this IServiceCollection services, ConnectionSettings connectionSettings, ProfilingSettings profilingSettings) { services.AddMongoDb(connectionSettings); services.AddSingleton(profilingSettings); services.Remove(new ServiceDescriptor(typeof(IMongoClientFactory), typeof(MongoClientFactory), ServiceLifetime.Singleton)); services.AddSingleton <IMongoClientFactory, ProfiledMongoClientFactory>(); return(services); }
public ProfiledMongoClientFactory(DependencyProfiler dependencyProfiler, ProfilingSettings profilingSettings) { _configurator = new ProfiledMongoClientSettings(dependencyProfiler, profilingSettings.DependencyName, profilingSettings.IgnoredCommands ?? Enumerable.Empty <string>()); }