我认为我应该将我的类库移动到使用.net standard 2.1。
表属性不是.net标准2.1中的吗?
using PWDRS.Core.Entities.Base;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PWDRS.Core.Entities
{
[Table("ReportType", Schema = "RF")]
public class RfReportType : EntityBase
{
public RfReportType()
{
}
类型或名称空间名称'DataAnnotations'在命名空间“ System.ComponentModel”(您是否缺少程序集参考?)
找不到类型或名称空间名称'TableAttribute'(是您缺少using指令或程序集引用吗?)
找不到类型或名称空间名称“表”(您是否丢失了using指令或程序集引用?)
找不到类型或名称空间名称'Schema'(您是缺少using指令或程序集引用?)
TableAttribute
属于System.ComponentModel.Annotations程序集,它是.NET Standard的TableAttribute
。而且似乎没有计划包含它,请参阅is not part
您需要将其作为软件包安装
this github issue
或使用Microsoft.EntityFrameworkCore程序包,其中包括System.ComponentModel.Annotations,如果需要更多信息
Install-Package System.ComponentModel.Annotations -Version 4.6.0