我有一个检索项目的 DAL 方法。这些项目存在于 DAL 方法中,但不存在于调用代码中。这怎么可能?
调用代码:
IEnumerable<InstallationSummary> installationSummaryList =
InstallationSummaryLogic.GetByServerAppAndGroup(appServer, appWithValidGroup);
显示项目确实存在的 DAL 方法:
调用代码,没有显示任何项目。他们去哪儿了?
(这是本问题顶部显示的同一行。)
DAL 方法和调用代码之间唯一的东西是一个逻辑类,它只是一个传递。为了完整起见,我将其包含在此处:
public static IEnumerable<InstallationSummary> GetByServerAppAndGroup(ApplicationServer appServer, ApplicationWithOverrideVariableGroup appWithGroup)
{
return DataAccessFactory.GetDataInterface<IInstallationSummaryData>().GetByServerAppAndGroup(appServer, appWithGroup);
}
编辑 - 显示整个 DAL 方法
public IEnumerable<InstallationSummary> GetByServerAppAndGroup(ApplicationServer appServer, ApplicationWithOverrideVariableGroup appWithGroup)
{
IQueryable<InstallationSummary> summaries = this.Database.InstallationSummaries
.Include(x => x.ApplicationServer)
.Include(x => x.ApplicationWithOverrideVariableGroup.Application)
.Include(x => x.ApplicationWithOverrideVariableGroup.CustomVariableGroup)
.Where(x => x.ApplicationServer.IdForEf == appServer.IdForEf)
.Where(x => x.ApplicationWithOverrideVariableGroup.Application.IdForEf == appWithGroup.Application.IdForEf);
if (appWithGroup.CustomVariableGroup == null)
{
return summaries.Where(x => x.ApplicationWithOverrideVariableGroup.CustomVariableGroup == null);
}
return summaries
.Where(x =>
x.ApplicationWithOverrideVariableGroup != null &&
x.ApplicationWithOverrideVariableGroup.CustomVariableGroup != null &&
x.ApplicationWithOverrideVariableGroup.CustomVariableGroup.IdForEf == appWithGroup.CustomVariableGroup.IdForEf);
}