新实体继承中的实体框架问题

发布于 2024-10-31 17:38:44 字数 530 浏览 1 评论 0原文

请问有懂行的人可以回答一下这个问题吗?我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云裳 2024-11-07 17:38:44

听起来您正在按照 MSDN 上的示例进行操作。在示例结束时,字段 EnrollmentDateHireDate 不再位于 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 and HireDate are no longer on the SchoolModel.Person class, they're on the subclasses SchoolModel.Instructor and SchoolModel.Student.

鯉魚旗 2024-11-07 17:38:44

我在完成演练时遇到了同样的问题。解决方案:只需删除页面上的旧 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

提笔书几行 2024-11-07 17:38:44

听起来您在添加 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"?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文