private static void DoAdd(IServiceCollection services, MySqlServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { MySqlProviderConnectorOptions mySqlConfig = new MySqlProviderConnectorOptions(config); MySqlProviderConnectorFactory factory = new MySqlProviderConnectorFactory(info, mySqlConfig); services.Add(new ServiceDescriptor(typeof(MySqlConnection), factory.Create, contextLifetime)); }
private static void DoAdd(IServiceCollection services, MySqlServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { var mySqlConfig = new MySqlProviderConnectorOptions(config); var factory = new MySqlProviderConnectorFactory(info, mySqlConfig, MySqlTypeLocator.MySqlConnection); services.Add(new ServiceDescriptor(typeof(IHealthContributor), ctx => new RelationalHealthContributor((IDbConnection)factory.Create(ctx), ctx.GetService <ILogger <RelationalHealthContributor> >()), contextLifetime)); }
public void UpdateConfiguration(MySqlServiceInfo si, MySqlProviderConnectorOptions configuration) { if (si == null) { return; } if (!string.IsNullOrEmpty(si.Uri)) { configuration.Port = si.Port; if (configuration.UrlEncodedCredentials) { configuration.Username = WebUtility.UrlDecode(si.UserName); configuration.Password = WebUtility.UrlDecode(si.Password); } else { configuration.Username = si.UserName; configuration.Password = si.Password; } configuration.Server = si.Host; configuration.Database = si.Path; } }
public MySqlProviderConnectorFactory(MySqlServiceInfo sinfo, MySqlProviderConnectorOptions config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _info = sinfo; _config = config; }
private static void DoAdd(IServiceCollection services, MySqlServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { Type mySqlConnection = ConnectorHelpers.FindType(MySqlTypeLocator.Assemblies, MySqlTypeLocator.ConnectionTypeNames); var mySqlConfig = new MySqlProviderConnectorOptions(config); var factory = new MySqlProviderConnectorFactory(info, mySqlConfig, mySqlConnection); services.Add(new ServiceDescriptor(typeof(IDbConnection), factory.Create, contextLifetime)); services.Add(new ServiceDescriptor(mySqlConnection, factory.Create, contextLifetime)); services.Add(new ServiceDescriptor(typeof(IHealthContributor), ctx => new RelationalHealthContributor((IDbConnection)factory.Create(ctx), ctx.GetService <ILogger <RelationalHealthContributor> >()), ServiceLifetime.Singleton)); }
private static void DoAdd(IServiceCollection services, MySqlServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime) { Type mySqlConnection = ConnectorHelpers.FindType(mySqlAssemblies, mySqlTypeNames); if (mySqlConnection == null) { throw new ConnectorException("Unable to find MySqlConnection, are you missing MySql ADO.NET assembly"); } MySqlProviderConnectorOptions mySqlConfig = new MySqlProviderConnectorOptions(config); MySqlProviderConnectorFactory factory = new MySqlProviderConnectorFactory(info, mySqlConfig, mySqlConnection); services.Add(new ServiceDescriptor(typeof(IDbConnection), factory.Create, contextLifetime)); services.Add(new ServiceDescriptor(mySqlConnection, factory.Create, contextLifetime)); }
public void UpdateConfiguration(MySqlServiceInfo si, MySqlProviderConnectorOptions configuration) { if (si == null) { return; } if (!string.IsNullOrEmpty(si.Uri)) { configuration.Port = si.Port; configuration.Username = si.UserName; configuration.Password = si.Password; configuration.Server = si.Host; configuration.Database = si.Path; } }
public MySqlProviderConnectorFactory(MySqlServiceInfo sinfo, MySqlProviderConnectorOptions config, Type type) { _info = sinfo; _config = config ?? throw new ArgumentNullException(nameof(config)); ConnectorType = type; }
public string Configure(MySqlServiceInfo si, MySqlProviderConnectorOptions configuration) { UpdateConfiguration(si, configuration); return(configuration.ToString()); }