mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-20 10:47:56 +08:00
DefaultContentManager performance upgrade (#8207)
This commit is contained in:

committed by
Sébastien Ros

parent
258a490536
commit
e19d835e5a
@@ -282,6 +282,11 @@ namespace Orchard.ContentManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<T> GetMany<T>(IEnumerable<int> ids, VersionOptions options, QueryHints hints) where T : class, IContent {
|
public IEnumerable<T> GetMany<T>(IEnumerable<int> ids, VersionOptions options, QueryHints hints) where T : class, IContent {
|
||||||
|
if (!ids.Any()) {
|
||||||
|
// since there are no ids, I have to get no item, so it makes
|
||||||
|
// sense to not do anything at all
|
||||||
|
return Enumerable.Empty<T>();
|
||||||
|
}
|
||||||
var contentItemVersionRecords = GetManyImplementation(hints, (contentItemCriteria, contentItemVersionCriteria) => {
|
var contentItemVersionRecords = GetManyImplementation(hints, (contentItemCriteria, contentItemVersionCriteria) => {
|
||||||
contentItemCriteria.Add(Restrictions.In("Id", ids.ToArray()));
|
contentItemCriteria.Add(Restrictions.In("Id", ids.ToArray()));
|
||||||
if (options.IsPublished) {
|
if (options.IsPublished) {
|
||||||
@@ -314,6 +319,11 @@ namespace Orchard.ContentManagement {
|
|||||||
|
|
||||||
|
|
||||||
public IEnumerable<ContentItem> GetManyByVersionId(IEnumerable<int> versionRecordIds, QueryHints hints) {
|
public IEnumerable<ContentItem> GetManyByVersionId(IEnumerable<int> versionRecordIds, QueryHints hints) {
|
||||||
|
if (!versionRecordIds.Any()) {
|
||||||
|
// since there are no ids, I have to get no item, so it makes
|
||||||
|
// sense to not do anything at all
|
||||||
|
return Enumerable.Empty<ContentItem>();
|
||||||
|
}
|
||||||
var contentItemVersionRecords = GetManyImplementation(hints, (contentItemCriteria, contentItemVersionCriteria) =>
|
var contentItemVersionRecords = GetManyImplementation(hints, (contentItemCriteria, contentItemVersionCriteria) =>
|
||||||
contentItemVersionCriteria.Add(Restrictions.In("Id", versionRecordIds.ToArray())));
|
contentItemVersionCriteria.Add(Restrictions.In("Id", versionRecordIds.ToArray())));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user