Ensures all resolvers are sealed. Changes CacheRefreshersResolver, DataTypesResolver, MacroFieldEditorsResolver, PackageActionsResolver, ActionsResolver

to all be lazy resolvers as they are not needed instantly on app startup (not needed by the front-end) This will
make app startup a lot quicker. Fixes ActionsResolver to not use the PluginManager to resolve the types when it
is instantiating them since these are passed in the ctor. Updates all unit tests to use lazy delegate for these resolvers
and they are all passing.
This commit is contained in:
Shannon Deminick
2013-01-23 18:40:40 +03:00
parent f467b8cb6c
commit 82c2560822
20 changed files with 36 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
namespace Umbraco.Core.ObjectResolution
@@ -83,6 +84,7 @@ namespace Umbraco.Core.ObjectResolution
private readonly List<Lazy<Type>> _lazyTypeList = new List<Lazy<Type>>();
private readonly List<Func<IEnumerable<Type>>> _listOfTypeListDelegates = new List<Func<IEnumerable<Type>>>();
private List<Type> _resolvedTypes = null;
private readonly ReaderWriterLockSlim _typeResolutionLock = new ReaderWriterLockSlim();
/// <summary>
/// Used for unit tests
@@ -99,7 +101,7 @@ namespace Umbraco.Core.ObjectResolution
{
get
{
using (var lck = GetUpgradeableReadLock())
using (var lck = new UpgradeableReadLock(_typeResolutionLock))
{
var lazyTypeList = _lazyTypeList.Select(x => x.Value).ToArray();
var listofTypeListDelegates = _listOfTypeListDelegates.SelectMany(x => x()).ToArray();