小编Fac*_*ero的帖子

System.InvalidOperationException: '找不到适合实体类型 'HealthCheck' 的构造函数

尝试通过 EF Core 在我的数据库上添加内容时出现此错误。

System.InvalidOperationException: '找不到适合实体类型 'HealthCheck' 的构造函数。以下构造函数的参数无法绑定到实体类型的属性:无法绑定“HealthCheck(string title, string hctype, string link)”中的“hctype”。

这是我的 HealthCheck 课程:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Application.Models
{
    public class HealthCheck
    {
        public HealthCheck(string title, string hctype, string link)
        {
            Title = title;
            HCType = hctype;
            Link = link;
        }

        public int Id { get; set; }
        public string Title { get; set; }
        public string HCType { get; set; }
        public string Link { get; set; }
    }
}

Run Code Online (Sandbox Code Playgroud)

我的存储库上下文 …

c# asp.net model-view-controller entity-framework-core

3
推荐指数
2
解决办法
5822
查看次数