【问题标题】:Can't make migration UWP SQLite EF无法迁移 UWP SQLite EF
【发布时间】:2016-05-22 21:27:36
【问题描述】:

你好,我正在关注https://blogs.windows.com/buildingapps/2016/05/03/data-access-in-universal-windows-platform-uwp-apps/上的教程

但我在迁移数据库时遇到了问题。

我尝试在 google 中搜索,但我找到的唯一解决方案是升级 EF,但我已经全部更新了。 错误:

PM> 添加迁移 MyFirstMigration System.MissingMethodException:找不到方法:'无效 Microsoft.Extensions.Logging.LoggerExtensions.LogVerbose(Microsoft.Extensions.Logging.ILogger,System.String)'。 在 Microsoft.Data.Entity.Design.DbContextOperations.CreateContext(字符串 contextType) 在 Microsoft.Data.Entity.Design.MigrationsOperations.AddMigration(字符串名称,字符串 outputDir,字符串 contextType) 在 Microsoft.Data.Entity.Design.OperationExecutor.d__7.MoveNext() 在 System.Linq.Buffer1..ctor(IEnumerable1 源) 在 System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Microsoft.Data.Entity.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_01.b__0() 在 Microsoft.Data.Entity.Design.OperationExecutor.OperationBase.Execute(操作动作) 找不到方法:'Void Microsoft.Extensions.Logging.LoggerExtensions.LogVerbose(Microsoft.Extensions.Logging.ILogger, System.String)'。

我现在该怎么办?

【问题讨论】:

  • @Bart 不太好,但也许我在我的实体模型中做错了什么。imgur.com/idEV1uA
  • 这很奇怪。你能把这个解决方案上传到某个地方吗?

标签: entity-framework sqlite uwp


【解决方案1】:

你可能一个人做错了什么。我已经复制了您的模型和 DbContext 并遵循了 official docs,它深入到以下命令:

Install-Package Microsoft.EntityFrameworkCore.SQLite –Pre
Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
Add-Migration MyFirstMigration

我已将我的工作示例上传到GitHub

【讨论】:

  • 似乎我还没有更新 Vs。我刚刚更新了,还没有更新。也许我应该重新安装,因为这里出了问题
猜你喜欢
  • 2017-05-29
  • 1970-01-01
  • 1970-01-01
  • 2017-07-11
  • 2021-08-16
  • 2018-03-17
  • 1970-01-01
  • 2021-12-25
  • 1970-01-01
相关资源
最近更新 更多