Merge branch temp8 into temp8-di2690

This commit is contained in:
Stephan
2018-12-07 09:52:46 +01:00
183 changed files with 7053 additions and 6809 deletions

View File

@@ -211,12 +211,20 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
//.Where(x => Equals(x, default(TId)) == false)
.ToArray();
if (ids.Length > 2000)
// can't query more than 2000 ids at a time... but if someone is really querying 2000+ entities,
// the additional overhead of fetching them in groups is minimal compared to the lookup time of each group
const int maxParams = 2000;
if (ids.Length <= maxParams)
{
throw new InvalidOperationException("Cannot perform a query with more than 2000 parameters");
return CachePolicy.GetAll(ids, PerformGetAll);
}
return CachePolicy.GetAll(ids, PerformGetAll);
var entities = new List<TEntity>();
foreach (var groupOfIds in ids.InGroupsOf(maxParams))
{
entities.AddRange(CachePolicy.GetAll(groupOfIds.ToArray(), PerformGetAll));
}
return entities;
}
/// <summary>