fixes tests

This commit is contained in:
Shannon
2016-01-27 19:44:36 +01:00
parent 7d9ba0e36e
commit 9a830e5de6
11 changed files with 28 additions and 18 deletions

View File

@@ -18,7 +18,9 @@ namespace Umbraco.Core.Cache
internal class FullDataSetRepositoryCachePolicy<TEntity, TId> : DefaultRepositoryCachePolicy<TEntity, TId>
where TEntity : class, IAggregateRoot
{
public FullDataSetRepositoryCachePolicy(IRuntimeCacheProvider cache) : base(cache,
private readonly Func<TEntity, TId> _getEntityId;
public FullDataSetRepositoryCachePolicy(IRuntimeCacheProvider cache, Func<TEntity, TId> getEntityId) : base(cache,
new RepositoryCachePolicyOptions
{
//Definitely allow zero'd cache entires since this is a full set, in many cases there will be none,
@@ -26,6 +28,7 @@ namespace Umbraco.Core.Cache
GetAllCacheAllowZeroCount = true
})
{
_getEntityId = getEntityId;
}
private bool? _hasZeroCountCache;
@@ -40,7 +43,7 @@ namespace Umbraco.Core.Cache
// 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.Where(x => ids.Contains(_getEntityId(x))).ToArray()
: result;
}