我正在使用代码生成来创建实体集,我希望能够像这样设置它们:
[Table("Person")]
public class Person_Generated {
[Key]
[Column("PersonId")]
public virtual int? PersonId { get; set; }
}
public class Person : Person_Generated { }
这将允许我稍后在Person类中添加/覆盖自定义属性。问题是,当我尝试使用人进行查询时,我收到此错误。
An unhandled exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll
Additional information: The type 'Person' was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive or generic, and does not inherit from EntityObject.
答案 0 :(得分:0)
我只是使用了部分类,因为看起来继承的类有问题。