新实体继承中的实体框架问题
请问有懂行的人可以回答一下这个问题吗?我的 Students.aspx 页面中的架构有问题。我已经完成了 演练,但我收到错误,并且我已将示例中的 edmx 文件复制到我的应用程序中,但仍然收到错误。这是错误:
“EnrollmentDate”不是以下成员 在中输入“SchoolModel.Person” 当前加载的模式。近简单 标识符,第 6 行,第 4 列。
我还创建了一个新的 EntityDataSource,但也遇到了同样的问题。该示例工作正常,但我似乎无法让 EnrollmentDate 和 HireDate 字段成为“SchoolModel.Person”实体的一部分。直到设置 EntityTypeFilter 然后我运行应用程序并遇到问题的部分
Could someone with some good knowledge answer this question please. Im having a problem with the schema in my Students.aspx page. I have done the walkthrough, but I get an error and I have copied the edmx file from the sample into my application and I still get the error. This is the error:
'EnrollmentDate' is not a member of
type 'SchoolModel.Person' in the
currently loaded schemas. Near simple
identifier, line 6, column 4.
I have also created a new EntityDataSource and I have the same problem. The sample works fine but I can't seem to get the EnrollmentDate and HireDate fields to be part of the 'SchoolModel.Person' Entity. The part which is Upto setting the EntityTypeFilter then I run the app and I get problems
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您正在按照 MSDN 上的示例进行操作。在示例结束时,字段
EnrollmentDate
和HireDate
不再位于SchoolModel.Person
类中,而是位于子类 <代码>SchoolModel.Instructor 和SchoolModel.Student
。It sounds like you're following the example on MSDN. By the end of the example, the fields
EnrollmentDate
andHireDate
are no longer on theSchoolModel.Person
class, they're on the subclassesSchoolModel.Instructor
andSchoolModel.Student
.我在完成演练时遇到了同样的问题。解决方案:只需删除页面上的旧 EntityDataSource 控件,放入新的 EntityDataSource,按照演练中给出的方式进行配置(实体集名称:People;EntityTypeFilter:学生或讲师),一切都会按预期进行!
法拉兹
I faced the same problem while going through that walkthrough. The solution: Just delete the old EntityDataSource control on the page, put new EntityDataSource, configure it as given in walkthrough (with entity set name: People; EntityTypeFilter: Student or instructor), And every thing works as it should!!
Faraz
听起来您在添加 EntityTypeFilter 属性时可能错过了一个或多个 EDS 控件。您确定访问学生或教师的所有 EDS 控件都具有 EntityTypeFilter="Student" 或 EntityTypeFilter="Instructor" 吗?
It sounds like you may have missed one or more EDS controls when you added the EntityTypeFilter attributes. Are you sure all your EDS controls that access students or instructors have EntityTypeFilter="Student" or EntityTypeFilter="Instructor"?