PluginManager TLC from v7

This commit is contained in:
Stephan
2017-03-05 11:51:20 +01:00
parent 3576794a64
commit 824cf30e2e
21 changed files with 737 additions and 685 deletions

View File

@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Umbraco.Core.Plugins;
namespace Umbraco.Web.Editors
{
internal interface IEditorValidator
internal interface IEditorValidator : IDiscoverable
{
Type ModelType { get; }
IEnumerable<ValidationResult> Validate(object model);

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core;
using Umbraco.Core.Plugins;
namespace Umbraco.Web.HealthCheck
{
@@ -9,7 +10,7 @@ namespace Umbraco.Web.HealthCheck
/// Provides a base class for health checks.
/// </summary>
[DataContract(Name = "healtCheck", Namespace = "")]
public abstract class HealthCheck
public abstract class HealthCheck : IDiscoverable
{
protected HealthCheck()
{

View File

@@ -1,8 +1,10 @@
namespace Umbraco.Web.Models.Trees
using Umbraco.Core.Plugins;
namespace Umbraco.Web.Models.Trees
{
/// <summary>
/// Marker interface for created applications in the umbraco backoffice
/// </summary>
public interface IApplication
public interface IApplication : IDiscoverable
{ }
}

View File

@@ -6,6 +6,7 @@ using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence;
using Umbraco.Core.Plugins;
using Umbraco.Core.Services;
using Umbraco.Web.Security;
using Umbraco.Web.WebApi;
@@ -15,7 +16,7 @@ namespace Umbraco.Web.Mvc
/// <summary>
/// Provides a base class for plugin controllers.
/// </summary>
public abstract class PluginController : Controller
public abstract class PluginController : Controller, IDiscoverable
{
private static readonly ConcurrentDictionary<Type, PluginControllerMetadata> MetadataStorage
= new ConcurrentDictionary<Type, PluginControllerMetadata>();

View File

@@ -295,7 +295,7 @@ namespace Umbraco.Web.Services
// Load all Applications by attribute and add them to the XML config
//don't cache the result of this because it is only used once during app startup, caching will just add a bit more mem overhead for no reason
var types = Current.PluginManager.ResolveTypesWithAttribute<IApplication, ApplicationAttribute>(cacheResult: false); // fixme - inject
var types = Current.PluginManager.ResolveTypesWithAttribute<IApplication, ApplicationAttribute>(cache: false); // fixme - inject
//since applications don't populate their metadata from the attribute and because it is an interface,
//we need to interrogate the attributes for the data. Would be better to have a base class that contains

View File

@@ -1,8 +1,10 @@
namespace Umbraco.Web.WebApi
using Umbraco.Core.Plugins;
namespace Umbraco.Web.WebApi
{
/// <summary>
/// Provides a base class for auto-routed Umbraco API controllers.
/// </summary>
public abstract class UmbracoApiController : UmbracoApiControllerBase
public abstract class UmbracoApiController : UmbracoApiControllerBase, IDiscoverable
{ }
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Reflection;
using LightInject;
using Umbraco.Core.DI;
using Umbraco.Core.Plugins;
using Umbraco.Web.UI.Pages;
namespace Umbraco.Web._Legacy.Actions
@@ -88,7 +89,7 @@ namespace Umbraco.Web._Legacy.Actions
}
}
public interface IAction
public interface IAction : IDiscoverable
{
char Letter { get; }
bool ShowInNotifier { get; }