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
Namespace: Sdl.Core.PluginFramework
Assembly: Sdl.Core.PluginFramework.dll
Syntax
public class ObjectRegistry<TExtensionAttribute, TExtensionType> : Object 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 | 
|---|---|
| TExtensionType[] | An array, containing a new instance of every object registered with the extension point.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| System.InvalidCastException | Thrown when any of the created objects cannot be cast to the required type.  |