4

我有一个检索项目的 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);
}
4

1 回答 1

6

您的方法使用调用GetByServerAppAndGroup过滤(我们看不到它的真正含义 - 如果您剪切并粘贴方法本身会很有帮助)。我的猜测是,其中没有一个结果通过调用中的过滤器。summariesWheresummariesWhere

于 2012-06-02T16:28:08.270 回答