mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge pull request #5897 from paynecrl97/patch-1
Fixes 1+n db call issue
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Orchard.Widgets.Services{
|
|||||||
// Once the Rule Engine is done:
|
// Once the Rule Engine is done:
|
||||||
// Get Layers and filter by zone and rule
|
// Get Layers and filter by zone and rule
|
||||||
// NOTE: .ForType("Layer") is faster than .Query<LayerPart, LayerPartRecord>()
|
// NOTE: .ForType("Layer") is faster than .Query<LayerPart, LayerPartRecord>()
|
||||||
var activeLayers = _orchardServices.ContentManager.Query<LayerPart>().ForType("Layer").List();
|
var activeLayers = _orchardServices.ContentManager.Query<LayerPart>().WithQueryHints(new QueryHints().ExpandParts<LayerPart>()).ForType("Layer").List();
|
||||||
|
|
||||||
var activeLayerIds = new List<int>();
|
var activeLayerIds = new List<int>();
|
||||||
foreach (var activeLayer in activeLayers) {
|
foreach (var activeLayer in activeLayers) {
|
||||||
@@ -59,4 +59,4 @@ namespace Orchard.Widgets.Services{
|
|||||||
return activeLayerIds.ToArray();
|
return activeLayerIds.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user