Hello,
I have two classes, ResourceGroup and Resource. I tried to include resource in groups loading, using DomainServices. I did it like this:
public IQueryable<ResourceGroup> GetResourceGroups() { return this.ObjectContext.ResourceGroups.Include(g => g.Resources.Where(r => r.IsActive == true)); } which does not work, and I get exception:
The include path expression must refer to a property defined by the entity, optionally also with nested properties or calls to Select.Parameter name: path
I tried even in metadata using Include annotation, and both version did just fine. But, I need to include only resources which have attribute IsActive = true. That is way I tried something like this:
[Include]
public ICollection<Resource> Resources
{
get
{
return Resources.Where(r => r.IsActive == true).ToArray();
}
set
{
Resources = value;
}
}
But I'm still getting all the resources...
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog