I don't understand where the records are going after they are loaded using Load()
. Where do these records get loaded? Are they accessible from the layers
or tmp1
variables? Ultimately, the method returns the layers
variable, but it does not seem like what is going on with query
and dbContext is affecting the layers
variable:
var layers = dbContext.DataLayer.Where(x => layerIds.Contains(x.DataLayerId)).ToList();
var tmp1 = dbContext.XYDateRelationshipUnderDI
.Where(x => x.XYDatedDI.Dated && layerIds.Contains(x.XYDatedDI.DataFeature.LayerId))
.ToList()
.Select(x => x.XYRelationshipId);
var query = dbContext.XYValueHolder
.Where(x => tmp1.Contains(x.XYRelationshipId))
.Where(x => x.XYValues.Count > 0);
// ...
query.Where(x => x.XYValues.Average(x => x.X) > item.ThresholdValue).Load();
// ...
dbContext.XYDatedDI
.Where(x => tmp1.Contains(x.XYRelationshipUnderDI.XYRelationshipId)).Load();
return layers;
Most examples I see online are related to using the Load method for a single entity or DbSet. I am very much a beginner with C# and Entity Framework so this bit of code in a file I am debugging has got me a little confused.