Entity Framework problem in new Entity Inheritance
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:
'Enrollme开发者_C百科ntDate' 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
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
.
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
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"?
精彩评论