Skip to content

IPluginFactory

NexusLabs.Needlr

NexusLabs.Needlr

IPluginFactory Interface

Defines a factory for discovering and creating plugin instances from assemblies.

public interface IPluginFactory

Methods

IPluginFactory.CreatePluginsFromAssemblies<TPlugin,TAttribute>(IEnumerable<Assembly>) Method

Creates instances of plugins of type TPlugin from the provided assemblies that are also decorated with the specified attribute.

System.Collections.Generic.IEnumerable<TPlugin> CreatePluginsFromAssemblies<TPlugin,TAttribute>(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies)
    where TPlugin : class
    where TAttribute : System.Attribute;

Type parameters

TPlugin

The plugin interface or base type to search for.

TAttribute

The attribute type to search for in the type hierarchy.

Parameters

assemblies System.Collections.Generic.IEnumerable<System.Reflection.Assembly>

A collection of assemblies to scan for plugin types.

Returns

System.Collections.Generic.IEnumerable<TPlugin>
An enumerable of instantiated plugins implementing TPlugin and decorated with TAttribute.

IPluginFactory.CreatePluginsFromAssemblies<TPlugin>(IEnumerable<Assembly>) Method

Creates instances of plugins of type TPlugin from the provided assemblies.

System.Collections.Generic.IEnumerable<TPlugin> CreatePluginsFromAssemblies<TPlugin>(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies)
    where TPlugin : class;

Type parameters

TPlugin

The plugin interface or base type to search for.

Parameters

assemblies System.Collections.Generic.IEnumerable<System.Reflection.Assembly>

A collection of assemblies to scan for plugin types.

Returns

System.Collections.Generic.IEnumerable<TPlugin>
An enumerable of instantiated plugins implementing TPlugin.

IPluginFactory.CreatePluginsWithAttributeFromAssemblies<TAttribute>(IEnumerable<Assembly>) Method

Creates instances of plugins from the provided assemblies that are decorated with the specified attribute.

System.Collections.Generic.IEnumerable<object> CreatePluginsWithAttributeFromAssemblies<TAttribute>(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies)
    where TAttribute : System.Attribute;

Type parameters

TAttribute

The attribute type to search for in the type hierarchy.

Parameters

assemblies System.Collections.Generic.IEnumerable<System.Reflection.Assembly>

A collection of assemblies to scan for plugin types.

Returns

System.Collections.Generic.IEnumerable<System.Object>
An enumerable of instantiated plugins decorated with TAttribute.