目前我正在尝试在 macOS 上开发 C# (ASP.NET MVC) Web 应用程序,我在 .NET 6.0.402 上运行
当我运行dotnet ef update database更新数据库时出现此错误:
未找到方法:“System.Collections.Generic.IList`1<Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention> Microsoft.EntityFrameworkCore.Metadata.Conventions.ConventionSet.get_ModelFinalizingConventions()”。
我确实摆弄了我的 Migrations-> [serial]_[name].designer.cs 文件,因为它没有自动生成信息来匹配我运行时的模型dotnet ef migrations add。
笑话.cs(模型)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace JokeWebApp.Models
{
public class Joke
{
public int Id { get; set; }
public string? JokeQuestion { get; set; }
public string? JokeAnswer { get; set; }
//ctor shortcut for constructor
public Joke()
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
20221109024428_initialsetup.Designer.cs(数据->迁移)
// <auto-generated …Run Code Online (Sandbox Code Playgroud)