Ensures that the main content type repositories are returning the correct result from their GetAll methods. Fixes the FullDataSetRepositoryCachePolicy to ensure that any request with Ids actually returns the result of GetAll and then filters to ensure caching is correct.

This commit is contained in:
Shannon
2016-01-27 19:26:08 +01:00
parent 2f8c43c689
commit 6c5e09fd84
5 changed files with 37 additions and 61 deletions

View File

@@ -30,6 +30,20 @@ namespace Umbraco.Core.Cache
private bool? _hasZeroCountCache;
public override TEntity[] GetAll(TId[] ids, Func<TId[], IEnumerable<TEntity>> getFromRepo)
{
//process the base logic without any Ids - we want to cache them all!
var result = base.GetAll(new TId[] { }, getFromRepo);
//now that the base result has been calculated, they will all be cached.
// Now we can just filter by ids if they have been supplied
return ids.Any()
? result.Where(x => ids.Contains((TId) (object) x.Id)).ToArray()
: result;
}
/// <summary>
/// For this type of caching policy, we don't cache individual items
/// </summary>