Updated TreeDefinitionCollection to use PluginTypeResolver and fixed its code to be thread safe.

Updated restExtensions to use PluginTypeResolver and added unit test for resolving these types.
Updated TypeFinder2 with a slight perf increase.
This commit is contained in:
shannon@ShandemVaio
2012-07-31 01:56:03 +06:00
parent 352d817fc1
commit 5da0445c32
8 changed files with 156 additions and 101 deletions

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Threading;
using Umbraco.Core;
using Umbraco.Web.Routing;
using umbraco.interfaces;
using umbraco.presentation.umbracobase;
namespace Umbraco.Web
@@ -12,16 +14,24 @@ namespace Umbraco.Web
/// </summary>
public static class PluginTypeResolverExtensions
{
/// <summary>
/// Returns all available ITrees in application
/// </summary>
/// <param name="resolver"></param>
/// <returns></returns>
internal static IEnumerable<Type> ResolveTrees(this PluginTypeResolver resolver)
{
return resolver.ResolveTypes<ITree>();
}
///// <summary>
///// Returns all IDocumentLookup types
///// </summary>
///// <param name="resolver"></param>
///// <returns></returns>
//internal static IEnumerable<Type> ResolveLookups(this PluginTypeResolver resolver)
//{
// return resolver.ResolveTypes<IDocumentLookup>();
//}
/// <summary>
/// Returns all classes attributed with RestExtension attribute
/// </summary>
/// <param name="resolver"></param>
/// <returns></returns>
internal static IEnumerable<Type> ResolveRestExtensions(this PluginTypeResolver resolver)
{
return resolver.ResolveAttributedTypes<RestExtension>();
}
}
}