Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I took a quick stab at it. Probably doesn't compile (Especially the "from teamsTalbe in teams), but the idea is you can factor out something that returns an IQueryable&lt;>. You're IQueryable returns an anonymous type though, which wouldn't work. So you may need to create an explicit type to use in place of 'select new { teamsTable, solutionsTable.SolutionName }'</p> <pre><code> public List&lt;TeamBE&gt; GetTeamsBySolutionID(int solutionID) { Esadmin db = new Esadmin(_connectionString); return GetTeamsBy(db, _GetTeamsBySolutionID(db, solutionID)); } IQueryable&lt;Team&gt; _GetTeamsBySolutionID(Esadmin db, int solutionID) { return from teamsTable in db.Teams where teamsTable.SolutionID == SolutionID select teamsTable; } List&lt;TeamBE&gt; GetTeamsBy(Esadmin db, IQueryable&lt;Team&gt; teams) { List&lt;TeamBE&gt; teams = new List&lt;TeamBE&gt;(); var qry = (from teamsTable in teams join solutionsTable in db.Solutions on teamsTable.SolutionID equals solutionsTable.SolutionID select new { teamsTable, solutionsTable.SolutionName }); foreach (var result in qry) { TeamBE team = new TeamBE(); team.TeamID = result.teamsTable.TeamID; team.Description = result.teamsTable.Description; team.Status = result.teamsTable.Status; team.LastModified = result.teamsTable.LastModified; team.SolutionID = result.teamsTable.SolutionID; team.SolutionName = result.SolutionName; team.Name = result.teamsTable.Name; team.LocationLevel = result.teamsTable.LocationLevel; team.AORDriven = result.teamsTable.AoRDriven; team.CriteriaID = result.teamsTable.CriteriaID ?? Guid.Empty; teams.Add(team); } return teams; } </code></pre>
 

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