2012-07-20 01:04:35 +06:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Umbraco.Core;
|
|
|
|
|
using Umbraco.Web.Routing;
|
|
|
|
|
using umbraco.BusinessLogic;
|
|
|
|
|
using umbraco.BusinessLogic.Utils;
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web
|
|
|
|
|
{
|
2012-07-20 23:42:55 +06:00
|
|
|
/// <summary>
|
2012-07-20 01:04:35 +06:00
|
|
|
/// Extension methods for the PluginResolver
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class PluginResolverExtensions
|
|
|
|
|
{
|
|
|
|
|
|
2012-07-21 00:20:50 +06:00
|
|
|
private static volatile IEnumerable<Type> _lookups;
|
2012-07-20 01:04:35 +06:00
|
|
|
private static readonly object Locker = new object();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns all available ILookup objects
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="plugins"></param>
|
|
|
|
|
/// <returns></returns>
|
2012-07-21 00:20:50 +06:00
|
|
|
internal static IEnumerable<Type> ResolveLookups(this PluginResolver plugins)
|
2012-07-20 01:04:35 +06:00
|
|
|
{
|
|
|
|
|
if (_lookups == null)
|
|
|
|
|
{
|
|
|
|
|
lock(Locker)
|
|
|
|
|
{
|
|
|
|
|
if (_lookups == null)
|
|
|
|
|
{
|
2012-07-21 00:20:50 +06:00
|
|
|
_lookups = TypeFinder.FindClassesOfType<ILookup>();
|
2012-07-20 01:04:35 +06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return _lookups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|