mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 21:41:40 +08:00
Fixing SELECT N+1 when listing blog archives
WORST SELECT N+1 EVER and it seems I wrote the code :/
This commit is contained in:
parent
a62f0281eb
commit
0c9e4e1224
@ -148,6 +148,10 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
|
||||
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
|
||||
<Name>Orchard.Autoroute</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.ContentPicker\Orchard.ContentPicker.csproj">
|
||||
<Project>{f301ef7d-f19c-4d83-aa94-cb64f29c037d}</Project>
|
||||
<Name>Orchard.ContentPicker</Name>
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Autoroute.Models;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
@ -19,7 +20,7 @@ namespace Orchard.Blogs.Services {
|
||||
}
|
||||
|
||||
public BlogPart Get(string path) {
|
||||
return _contentManager.Query<BlogPart>().List().FirstOrDefault(rr => rr.As<IAliasAspect>().Path == path);
|
||||
return _contentManager.Query<AutoroutePart, AutoroutePartRecord>().Where(r => r.DisplayAlias == path).ForPart<BlogPart>().Slice(0, 1).FirstOrDefault();
|
||||
}
|
||||
|
||||
public ContentItem Get(int id, VersionOptions versionOptions) {
|
||||
|
Loading…
Reference in New Issue
Block a user