ABP改爲MYSQL遇坑記

公司內部只支持.NET CORE 2.1版本,所以採用ABP版本4.2進行功能開發,還需要修改sqlserver爲MYSQL

1.安裝pomelo.entityframeworkcore.mysql和Pomelo.EntityFrameworkCore.MySql.Design

工具>nuget 包管理器>管理解決方案的nuget程序包

選擇entityframeworkcore和web兩個項目,然後版本選擇pomelo.entityframeworkcore.mysql 爲2.1版本(不能選擇最新3.1版本)

這裏如果選擇3.1版本會出現如下問題:

System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalParameterBuilder..ctor(Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.
   at Microsoft.EntityFrameworkCore.Storage.Internal.MySqlCommandBuilder..ctor(IDiagnosticsLogger`1 logger, IRelationalTypeMapper typeMapper)
   at Microsoft.EntityFrameworkCore.Storage.Internal.MySqlCommandBuilderFactory.CreateCore(IDiagnosticsLogger`1 logger, IRelationalTypeMapper relationalTypeMapper)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RawSqlCommandBuilder.Build(String sql)
   at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalParameterBuilder..ctor(Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.

通過選擇2.1版本後解決

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章