Code First for Mysql 错误:未为提供程序“MySql.Data.MySqlClient”找到任何 MigrationSqlGenerator。请在目标迁移配置类中使用 SetSql
16lz
2021-01-22
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; } }
更多相关文章
- 为什么我们应该将XMPP而不是JSON用于简单(仅文本)消息传递应用程序
- Android - 在一个应用程序中启动另外一个已经安装的应用程序或系
- Android混合应用程序:JQueryMobile ajax不支持https,但可以使用htt
- 第三部分:Android 应用程序接口指南---第二节:UI---第六章 对话框
- 如何将本机应用程序(android)与phonegap应用程序集成
- 为什么我的Android应用程序偶尔可以非常快地耗尽电池?
- 如何在android 5.0(L)中运行应用程序活动名称?
- Android应用程序启动过程上
- Java Android套接字连接。错误的IP地址导致应用程序停止响应