我正在使用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;} }
这个错误是否发生,因为我实际上没有这个类,因为我首先在数据库中做EDMX中的所有内容?
谢谢!
跳蚤