mysql 数据库迁移报错:
PM> add-migration udpate2015_9_20
<span style="color:#ff0000;">未为提供程序“MySql.Data.MySqlClient”找到任何 MigrationSqlGenerator。请在目标迁移配置类中使用 SetSqlGenerator 方法以注册其他 SQL 生成器。</span>
错误的原因:
没有指定当前上线文所处的程序集
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public class WLContext : DbContext
{
}
// 摘要:
// 可将此属性置于 System.Data.Entity.DbContext 的子类上,以指示 System.Data.Entity.DbConfiguration
// 的子类,后者表示应用程序的基于代码的配置与上下文类型处于不同的程序集中。
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
[SuppressMessage("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
public class DbConfigurationTypeAttribute : Attribute
{
// 摘要:
// 指示应对此应用程序的基于代码的配置使用由给定程序集限定名称表示的 System.Data.Entity.DbConfiguration 的子类。
//
// 参数:
// configurationTypeName:
// 要使用的 System.Data.Entity.DbConfiguration 类型。
public DbConfigurationTypeAttribute(string configurationTypeName);
//
// 摘要:
// 指示应对此应用程序的基于代码的配置使用 System.Data.Entity.DbConfiguration 的给定子类。
//
// 参数:
// configurationType:
// 要使用的 System.Data.Entity.DbConfiguration 类型。
public DbConfigurationTypeAttribute(Type configurationType);
// 摘要:
// 获取应对此应用程序的基于代码的配置使用的 System.Data.Entity.DbConfiguration 的子类。
//
// 返回结果:
// 应对此应用程序的基于代码的配置使用的 System.Data.Entity.DbConfiguration 的子类。
public Type ConfigurationType { get; }
}