Class ObjectRegistry<TExtensionAttribute, TExtensionType>
Helper class for implementers of extension points, which allows easy instantiation of all extensions registered with an extension point identified by a specific type of extension attribute.
Inheritance
Inherited Members
Namespace: SdlSdl.CorePluginFramework
Assembly: Sdl.Core.PluginFramework.dll
Syntax
public class ObjectRegistry<TExtensionAttribute, TExtensionType> where TExtensionAttribute : ExtensionAttribute where TExtensionType : class
Type Parameters
Name | Description |
---|---|
TExtensionAttribute | The type of extension attribute, identifying the extension point. |
TExtensionType | The type of the extension implementation classes for the extension point. |
Constructors
ObjectRegistry(IPluginRegistry)
Constructs an object registry for the specified extension attribute.
Declaration
public ObjectRegistry(IPluginRegistry pluginRegistry)
Parameters
Type | Name | Description |
---|---|---|
IPluginRegistry | pluginRegistry | The plug-in registry from which to retrieve the extensions. |
Properties
ExtensionPoint
Returns the id of the extension point from which the objects should be loaded.
Declaration
public IExtensionPoint ExtensionPoint { get; }
Property Value
Type | Description |
---|---|
IExtensionPoint |
Methods
CreateObjects()
Creates an instance of all the objects registered with the extension point an returns them as an array.
Declaration
public virtual TExtensionType[] CreateObjects()
Returns
Type | Description |
---|---|
An array, containing a new instance of every object registered with the extension point. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | Thrown when any of the created objects cannot be cast to the required type. |