Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble with RIA Services and lambda JOIN
    text
    copied!<p>NOTE: This has been answered as duplicate in the comment below.</p> <p>I am having trouble getting RIA Services to return the data I need and not more than the data I need. I have a parent object (Project) which contains a number of children. One is a Component (one Component per Project). Another is a ProjectParticipant which needs to be limited based on the ParticipantRole, and I also need to grab the Person information (related to ProjectParticipant).</p> <p>Here is some code I had earlier tried:</p> <pre><code>public IQueryable&lt;IMSModel.Project&gt; GetProjectHierarchy(String id) { return this.ObjectContext.Projects .Include("Component") .Include("ProjectParticipants") .Include("ProjectParticipants.Person") .Where(p =&gt; p.Program.ProgramType.lookupName == "EVDBE" &amp;&amp; p.ProjectOrgs.Any(po =&gt; po.orgId == id) &amp;&amp; p.ProjectParticipants.Any(pp =&gt; (pp.postId == id)) &amp;&amp; p.ProjectParticipants.Any(pp =&gt; pp.PersonStatus.lookupName == "A") &amp;&amp; p.ProjectParticipants.Any(pp =&gt; pp.ParticipantRole.participantInd == "Y")) .OrderBy(p =&gt; new { p.fiscalYear, p.title }) .OrderByDescending(p =&gt; p.fiscalYear); } </code></pre> <p>This doesn't work too badly, but I end up getting ProjectParticipant objects that I do not want. What I really want to do is limit the ProjectParticipant objects to those that have ParticipantRole.participantInd == "Y".</p> <p>I tried another possible syntax for this, which is as follows:</p> <pre><code>public IQueryable&lt;IMSModel.Project&gt; GetProjectHierarchy(String id) { return this.ObjectContext.Projects .Include("Component") .Join(this.ObjectContext.ProjectParticipants .Include("ProjectParticipants.Person") .Where( pp =&gt; pp.ParticipantRole.participantInd == "Y" &amp;&amp; pp.postId == id &amp;&amp; pp.PersonStatus.lookupName == "A" ) , p =&gt; p.id , pp =&gt; pp.projectId , (p, pp) =&gt; p ) .Where(p =&gt; p.Program.ProgramType.lookupName == "EVDBE" &amp;&amp; p.ProjectOrgs.Any(po =&gt; po.orgId == id)); } </code></pre> <p>I would think that this would return something a lot closer to what I might want. The only issue is that I don't get anything back in my hierarchical tree view. Something was returned, as blank locations were created for each record, but my bindings are not displaying any information. The bindings for the first example do show data, whereas the bindings for the second (more limited result set as I am not using Any()) does not show data.</p> <p>I have been banging my head against this one for quite some time now and cannot resolve. Any assistance would be great.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload