Class PluginManager
Provides methods to find and instanciate types.
Inheritance
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public class PluginManager
Remarks
This class should be used to resolve all types, the TypeFinder class should never be used directly.
In most cases this class is not used directly but through extension methods that retrieve specific types.
This class caches the types it knows to avoid excessive assembly scanning and shorten startup times, relying on a hash of the DLLs in the ~/bin folder to check for cache expiration.
Properties
Current
Gets or sets the singleton instance.
Declaration
public static PluginManager Current { get; set; }
Property Value
Type | Description |
---|---|
PluginManager |
Remarks
The setter exists for unit tests.
Methods
ClearPluginCache()
Removes cache files and internal cache.
Declaration
public void ClearPluginCache()
Remarks
Generally only used for resetting cache, for example during the install process.
ResolveAttributedTypes<TAttribute>(Boolean, IEnumerable<Assembly>)
Resolves class types marked with the specified attribute.
Declaration
public IEnumerable<Type> ResolveAttributedTypes<TAttribute>(bool cache = true, IEnumerable<Assembly> specificAssemblies = null)where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | cache | Indicates whether to use cache for type resolution. |
System.Collections.Generic.IEnumerable<System.Reflection.Assembly> | specificAssemblies | A set of assemblies for type resolution. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> | All class types marked with the specified attribute. |
Type Parameters
Name | Description |
---|---|
TAttribute | The type of the attribute. |
Remarks
Caching is disabled when using specific assemblies.
ResolveTypes<T>(Boolean, IEnumerable<Assembly>)
Resolves class types inheriting from or implementing the specified type
Declaration
public IEnumerable<Type> ResolveTypes<T>(bool cache = true, IEnumerable<Assembly> specificAssemblies = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | cache | Indicates whether to use cache for type resolution. |
System.Collections.Generic.IEnumerable<System.Reflection.Assembly> | specificAssemblies | A set of assemblies for type resolution. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> | All class types inheriting from or implementing the specified type. |
Type Parameters
Name | Description |
---|---|
T | The type to inherit from or implement. |
Remarks
Caching is disabled when using specific assemblies.
ResolveTypesWithAttribute<T, TAttribute>(Boolean, IEnumerable<Assembly>)
Resolves class types inheriting from or implementing the specified type and marked with the specified attribute.
Declaration
public IEnumerable<Type> ResolveTypesWithAttribute<T, TAttribute>(bool cache = true, IEnumerable<Assembly> specificAssemblies = null)where TAttribute : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | cache | Indicates whether to use cache for type resolution. |
System.Collections.Generic.IEnumerable<System.Reflection.Assembly> | specificAssemblies | A set of assemblies for type resolution. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> | All class types inheriting from or implementing the specified type and marked with the specified attribute. |
Type Parameters
Name | Description |
---|---|
T | The type to inherit from or implement. |
TAttribute | The type of the attribute. |
Remarks
Caching is disabled when using specific assemblies.