【发布时间】:2021-09-24 19:27:55
【问题描述】:
如何向分部类添加注释。
在部分课程中:
//[MetadataType(typeof(Table.Invoice_Details))]
[MetadataTypeAttribute(typeof(Table.Invoice_Details))]
public partial class Invoice_Details
{
[Display(Name = "Quantity")]
public int Quantity { get; set; }
}
在 EntityFrameWork 中
public partial class Invoice_Details
{
public int Quantity { get; set; }
}
我尝试了不止一种方法,但最后我收到一条失败消息:
错误 CS0102 类型“Invoice_Details”已包含定义 对于'数量'
【问题讨论】:
-
可能重复?你的问题和this one一样吗?
-
这能回答你的问题吗? Can I define properties in partial classes, then mark them with attributes in another partial class?(由 Sean, ty 提供)
标签: c#