private static void DoAdd(IServiceCollection services, IConfiguration config, MySqlServiceInfo info, Type dbContextType, ServiceLifetime contextLifetime) { var mySqlConfig = new MySqlProviderConnectorOptions(config); var factory = new MySqlDbContextConnectorFactory(info, mySqlConfig, dbContextType); services.Add(new ServiceDescriptor(dbContextType, factory.Create, contextLifetime)); }
private static void DoAdd(IServiceCollection services, IConfiguration config, MySqlServiceInfo info, Type dbContextType, ServiceLifetime contextLifetime) { var mySqlConfig = new MySqlProviderConnectorOptions(config); var factory = new MySqlDbContextConnectorFactory(info, mySqlConfig, dbContextType); services.Add(new ServiceDescriptor(dbContextType, factory.Create, contextLifetime)); var healthFactory = new MySqlProviderConnectorFactory(info, mySqlConfig, MySqlTypeLocator.MySqlConnection); services.Add(new ServiceDescriptor(typeof(IHealthContributor), ctx => new RelationalDbHealthContributor((IDbConnection)healthFactory.Create(ctx), ctx.GetService <ILogger <RelationalDbHealthContributor> >()), contextLifetime)); }