RE: Non-projection includes error on foreign key
-
Thursday, May 03, 2012 8:15 AM
Hey!
Today I ran into a very weird issue with WCF-Services. I have two inheritance structures in my entity-domain:
1) Doctor and Assistant, which both inherit from Staff, which interits from User
2) PlanningAppointment and PatientAppointment, which both inherit from AppointmentIn Staff, I want a:
[Include]
public ICollection<Appointment> Appointments { get; set; }and in Appointment I want:
[Include]
public Staff Staff { get; set; }
public int StaffId { get; set; }I have tons of other classes that do that. But in this particular instance, WCF RIA Services start to cry (btw, I use the latest Ria.EntityFramework NuGet package). The compiler says:
Error 1 Invalid Include specification for member 'Staff.Appointments'. Non-projection includes can only be specified on members with the AssociationAttribute applied. [...]
Error 2 Invalid Include specification for member 'Appointment.Staff'. Non-projection includes can only be specified on members with the AssociationAttribute applied. [...]If I remove the [Include] on the ICollection, the error is gone (but of course, on the SL side, I don't have a Staff.Appointments attribute).
I already tried to put an [Association]-attribute on there. This fixes this particular error, but this sets a whole cascade of errors in motion where I end up putting an [Association]-attribute on every foreign-key and a [Key]-attribute on every entity - error by error (fixing one triggers the next, ...). When I'm done with that, the generated code in Silverlight wants to compare the Id to an EntityCollection in the filter-methods -> fail.
Where does this suddenly come from? Why doesn't it work on those two classes?
All Replies
-
Thursday, May 03, 2012 2:47 PM
Find for same:
http://stackoverflow.com/questions/5428358/custom-property-in-ria-service-not-available-on-client
http://social.microsoft.com/Forums/sl-SI/Offtopic/thread/e9d176f5-7552-47d9-8f9f-f1e1b12a4b1d
Many-to-many using Entity Framework 4.1 Code-First, RIA/DomainDataSource, and DataAnnotations

