hide concurrent dictionary from folder subclasses
This commit is contained in:
parent
2ccd7d3e77
commit
18a909797f
|
@ -1042,7 +1042,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
throw new ArgumentNullException("user");
|
throw new ArgumentNullException("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user.Configuration.MaxParentalRating == null)
|
var maxAllowedRating = user.Configuration.MaxParentalRating;
|
||||||
|
|
||||||
|
if (maxAllowedRating == null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1067,7 +1069,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value.Value <= user.Configuration.MaxParentalRating.Value;
|
return value.Value <= maxAllowedRating.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -476,7 +476,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
LazyInitializer.EnsureInitialized(ref _children, ref _childrenInitialized, ref _childrenSyncLock, LoadChildren);
|
LazyInitializer.EnsureInitialized(ref _children, ref _childrenInitialized, ref _childrenSyncLock, LoadChildrenInternal);
|
||||||
return _children;
|
return _children;
|
||||||
}
|
}
|
||||||
private set
|
private set
|
||||||
|
@ -529,16 +529,20 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ConcurrentDictionary<Guid, BaseItem> LoadChildrenInternal()
|
||||||
|
{
|
||||||
|
return new ConcurrentDictionary<Guid, BaseItem>(LoadChildren().ToDictionary(i => i.Id));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads our children. Validation will occur externally.
|
/// Loads our children. Validation will occur externally.
|
||||||
/// We want this sychronous.
|
/// We want this sychronous.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>ConcurrentBag{BaseItem}.</returns>
|
/// <returns>ConcurrentBag{BaseItem}.</returns>
|
||||||
protected virtual ConcurrentDictionary<Guid, BaseItem> LoadChildren()
|
protected virtual IEnumerable<BaseItem> LoadChildren()
|
||||||
{
|
{
|
||||||
//just load our children from the repo - the library will be validated and maintained in other processes
|
//just load our children from the repo - the library will be validated and maintained in other processes
|
||||||
return new ConcurrentDictionary<Guid, BaseItem>(GetCachedChildren().ToDictionary(i => i.Id));
|
return GetCachedChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
using System;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -111,7 +110,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Override to return the children defined to us when we were created
|
/// Override to return the children defined to us when we were created
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The actual children.</value>
|
/// <value>The actual children.</value>
|
||||||
protected override ConcurrentDictionary<Guid,BaseItem> LoadChildren()
|
protected override IEnumerable<BaseItem> LoadChildren()
|
||||||
{
|
{
|
||||||
var originalChildSource = ChildSource.ToList();
|
var originalChildSource = ChildSource.ToList();
|
||||||
|
|
||||||
|
@ -136,7 +135,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
// Now - since we built the index grouping from the bottom up - we now need to properly set Parents from the top down
|
// Now - since we built the index grouping from the bottom up - we now need to properly set Parents from the top down
|
||||||
SetParents(this, kids.OfType<IndexFolder>());
|
SetParents(this, kids.OfType<IndexFolder>());
|
||||||
|
|
||||||
return new ConcurrentDictionary<Guid, BaseItem>(kids.DistinctBy(i => i.Id).ToDictionary(i => i.Id));
|
return kids.DistinctBy(i => i.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user