IEnumerable Items Disappear - Exist in DAL but not calling

I have a DAL method that retrieves elements. Elements exist in the DAL method, but not in the calling code. How is this possible?

Call Code:

IEnumerable<InstallationSummary> installationSummaryList = InstallationSummaryLogic.GetByServerAppAndGroup(appServer, appWithValidGroup); 

The DAL method shows that the elements really exist:

enter image description here

Call code that does not display any items. Where did they go?
(This is the same line shown at the top of this question.)

enter image description here

The only thing that exists between the DAL method and the calling code is a boolean class that is simply pass-through. For completeness, I have included it here:

  public static IEnumerable<InstallationSummary> GetByServerAppAndGroup(ApplicationServer appServer, ApplicationWithOverrideVariableGroup appWithGroup) { return DataAccessFactory.GetDataInterface<IInstallationSummaryData>().GetByServerAppAndGroup(appServer, appWithGroup); } 

Edit - Show the entire DAL method

 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
source share
1 answer

Your GetByServerAppAndGroup method filters summaries by calling Where (we cannot see what it really is - it would be useful if you yourself cut and enter this method). I assume that none of the results in summaries pass a filter in the Where call.

+6
source

Source: https://habr.com/ru/post/1415734/


All Articles