mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +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 {
|
||||
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) => {
|
||||
contentItemCriteria.Add(Restrictions.In("Id", ids.ToArray()));
|
||||
if (options.IsPublished) {
|
||||
@@ -314,6 +319,11 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
|
||||
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) =>
|
||||
contentItemVersionCriteria.Add(Restrictions.In("Id", versionRecordIds.ToArray())));
|
||||
|
||||
|
Reference in New Issue
Block a user