Então, a solução final é:
-
Crie seu próprio sucessor DbConfiguration com blackjack e prostitutas:
public class MultipleDbConfiguration : DbConfiguration { #region Constructors public MultipleDbConfiguration() { SetProviderServices(MySqlProviderInvariantName.ProviderName, new MySqlProviderServices()); } #endregion Constructors #region Public methods public static DbConnection GetMySqlConnection(string connectionString) { var connectionFactory = new MySqlConnectionFactory(); return connectionFactory.CreateConnection(connectionString); } #endregion Public methods }
-
Marque Ms_SqlContext com MultipleDbConfiguration (e não faça mais nada com esse tipo de DbContext)
[DbConfigurationType(typeof(MultipleDbConfiguration))] partial class Ms_SqlContext { }
-
Marque Ms_SqlContext com MultipleDbConfiguration e ajuste MY_SqlContext(string nameOrConnectionString) com chamada MultipleDbConfiguration.GetMySqlConnection(nameOrConnectionString)
[DbConfigurationType(typeof(MultipleDbConfiguration))] partial class MY_SqlContext : DbContext { public MY_SqlContext(string nameOrConnectionString) : base(MultipleDbConfiguration.GetMySqlConnection(nameOrConnectionString), true) {} }
-
É ISSO!!!