completes: U4-4103 Publicize PluginManager for devs to use to create their own plugins

This commit is contained in:
Shannon
2014-02-17 15:08:27 +11:00
parent f7a703195c
commit ffbf8b2fd6

View File

@@ -33,7 +33,7 @@ namespace Umbraco.Core
/// it will use the cached resolved plugins that it has already found which means that no assembly scanning is necessary. This leads
/// to much faster startup times.
/// </remarks>
internal class PluginManager
public class PluginManager
{
private readonly ApplicationContext _appContext;
private const string CacheKey = "umbraco-plugins.list";
@@ -106,7 +106,7 @@ namespace Umbraco.Core
/// <remarks>
/// The setter is generally only used for unit tests
/// </remarks>
internal static PluginManager Current
public static PluginManager Current
{
get
{
@@ -750,12 +750,13 @@ namespace Umbraco.Core
UpdateCachedPluginsFile<T>(typeList.GetTypes(), resolutionKind);
}
#region Public Methods
/// <summary>
/// Generic method to find the specified type and cache the result
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
internal IEnumerable<Type> ResolveTypes<T>(bool cacheResult = true)
public IEnumerable<Type> ResolveTypes<T>(bool cacheResult = true)
{
return ResolveTypes<T>(
() => TypeFinder.FindClassesOfType<T>(AssembliesToScan),
@@ -769,7 +770,7 @@ namespace Umbraco.Core
/// <typeparam name="T"></typeparam>
/// <typeparam name="TAttribute"></typeparam>
/// <returns></returns>
internal IEnumerable<Type> ResolveTypesWithAttribute<T, TAttribute>(bool cacheResult = true)
public IEnumerable<Type> ResolveTypesWithAttribute<T, TAttribute>(bool cacheResult = true)
where TAttribute : Attribute
{
return ResolveTypes<T>(
@@ -783,14 +784,15 @@ namespace Umbraco.Core
/// </summary>
/// <typeparam name="TAttribute"></typeparam>
/// <returns></returns>
internal IEnumerable<Type> ResolveAttributedTypes<TAttribute>(bool cacheResult = true)
public IEnumerable<Type> ResolveAttributedTypes<TAttribute>(bool cacheResult = true)
where TAttribute : Attribute
{
return ResolveTypes<TAttribute>(
() => TypeFinder.FindClassesWithAttribute<TAttribute>(AssembliesToScan),
TypeResolutionKind.FindAttributedTypes,
cacheResult);
}
}
#endregion
/// <summary>
/// Used for unit tests