小编mle*_*eng的帖子

如何解决 找不到方法:System.Collections.Generic.IList`1<Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention>

目前我正在尝试在 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)

c# macos asp.net-mvc

12
推荐指数
2
解决办法
1万
查看次数

标签 统计

asp.net-mvc ×1

c# ×1

macos ×1