```DbProviderFactories.RegisterFactory("System.Data.MySql", MySqlConnectorFactory.Instance); serviceCollection.AddSingleton(DbProviderFactories.GetFactory("System.Data.MySql")); serviceCollection.AddTransient<MySqlConnection>(provider => new MySqlConnection(config.GetConnectionString("Default")));```