Fle*_*lea 5 entity-framework-4.1 asp.net-mvc-3
我正在使用Entity Framework 4.1并使用数据库第一种方法生成我的类.我的解决方案中有一个EDMX文件.
我正在尝试使用MetadataTypeAttribute方法向我的类添加属性,这似乎是在编辑T4模板之外这样做的推荐方法,但是,我似乎无法让它工作,因为我不断收到此编译错误:
"患者"是"PatientManagementSystem.Patient"和"PatientManagementSystem.Models.Patient"之间的模糊参考.
这是我正在使用的代码:
[MetadataTypeAttribute(typeof(PatientMetadata))]
public partial class Patient
{
}
public class PatientMetadata
{
[Required]
public string LastName {get; set;}
}
Run Code Online (Sandbox Code Playgroud)
这个错误是否发生,因为我实际上没有这个类,因为我首先在数据库中做EDMX中的所有内容?
谢谢!跳蚤
| 归档时间: |
|
| 查看次数: |
1264 次 |
| 最近记录: |