连接后的Linq过滤器

连接后的Linq过滤器,linq,Linq,我将在linq中加入4个不同的列表。然后,我需要在选择“新建”之前进行筛选。我很难弄明白这一点 var results2 = from st in this join currentGrowth in levels on new {st.Core, st.Grade } equals new {currentGrowth.Core, currentGrowth.Grade } into currentLevel from level

我将在linq中加入4个不同的列表。然后,我需要在选择“新建”之前进行筛选。我很难弄明白这一点

var results2 = from st in this

               join currentGrowth in levels on new {st.Core, st.Grade } equals new {currentGrowth.Core, currentGrowth.Grade } into currentLevel
               from level in currentLevel.Where(a => st.Score >= a.MinScore && st.Score <= a.MaxScore).DefaultIfEmpty()

               join growthScores in ScoresGrowth on new { st.id, st.Core } equals new { growthScores.id, growthScores.Core } into gs
               from gscores in gs.Where(a => !a.Passed && !st.Passed && a.TestName != st.TestName).DefaultIfEmpty()

               join pastGrowth in levels on new { gscores?.Core, gscores?.Grade } equals new { pastGrowth?.Core, pastGrowth?.Grade } into pLevel
               from pastLevel in pLevel.Where(a => gscores.Score >= a.MinScore && gscores.Score <= a.MaxScore).DefaultIfEmpty()

               group new { st, gscores, level, pastLevel } by new { st.Division, st.School, st.Core }
               into testGroups

               select new
               {
                   Division = testGroups.Key.Division,
                   Core = testGroups.Key.Core,
                   School = testGroups.Key.School,
                   All_Total = testGroups.Count(),
                   All_PassCount = testGroups.Count(a => a.st.Passed),
                   All_Growth = testGroups.Count(a=> !a.st.Passed && (a.level?.Level > a.pastLevel?.Level) )
               };
var results2=来自本例中的st
将新{st.Core,st.Grade}上的级别中的currentGrowth连接到currentLevel中等于将新{currentGrowth.Core,currentGrowth.Grade}连接到currentLevel中
来自currentLevel.Where中的级别(a=>st.Score>=a.MinScore&&st.Score!a.Passed&&st.Passed&&a.TestName!=st.TestName)。DefaultIfEmpty()
将新{gscores?.Core,gscores?.Grade}等于新{pastGrowth?.Core,pastGrowth?.Grade}上的pastGrowth按级别连接到pLevel中
从pLevel.中的pastLevel开始,其中(a=>gscore.Score>=a.MinScore&&gscore.Score a.st.Passed),
All_Growth=testGroups.Count(a=>!a.st.Passed&&(a.level?.level>a.passlevel?.level))
};
我需要将以下筛选器应用于在select中检索的字段。是否有方法在“选择新”之前执行此操作,或者必须将其应用于“选择新”中的每个计算。这里包含的内容远不止这些

!(st.SOA_LEP && !st.Passed && pastLevel.Level < level.Level)
 && !(st.SOA_Transfer && !st.Passed && pastLevel.Level < level.Level)
!(st.SOA_LEP&&!st.Passed&&pastLevel.Level
在来自st的
之后应用
st
条件。
a
应该是什么?对不起,a是过去的级别。我已经编辑了代码。如果我在ST上应用这些条件,那么我就无法访问级别和过去的级别联接。