Class CompositionBootstrapper
A bootstrapper for making it possible to load Addons to Dapplo applications.
This uses MEF for loading and managing the Addons.
Inheritance
System.Object
CompositionBootstrapper
Namespace:Dapplo.Addons.Bootstrapper
Assembly:Dapplo.Addons.Bootstrapper.dll
Syntax
public class CompositionBootstrapper : object, IBootstrapper, IServiceLocator, IMefServiceLocator, IServiceExporter, IServiceRepository, IDependencyProvider, IDisposable
Constructors
|
Improve this Doc
View Source
CompositionBootstrapper()
Make sure the assembly resolver is active as soon as the Bootstrapper is initialized.
Tthis makes sure assemblies which are embedded or in a subdirectory can be found.
Declaration
public CompositionBootstrapper()
Properties
|
Improve this Doc
View Source
AggregateCatalog
The AggregateCatalog contains all the catalogs with the assemblies in it.
Declaration
protected AggregateCatalog AggregateCatalog { get; set; }
Property Value
Type |
Description |
AggregateCatalog |
|
|
Improve this Doc
View Source
CompositionOptionFlags
Specify how the composition is made, is used in the Run()
Declaration
protected CompositionOptions CompositionOptionFlags { get; set; }
Property Value
Type |
Description |
CompositionOptions |
|
|
Improve this Doc
View Source
Container
Declaration
protected CompositionContainer Container { get; set; }
Property Value
Type |
Description |
CompositionContainer |
|
|
Improve this Doc
View Source
ExportProviders
Declaration
public IList<ExportProvider> ExportProviders { get; }
Property Value
Type |
Description |
IList<ExportProvider> |
|
|
Improve this Doc
View Source
Specify if the Aggregate Catalog is configured
Declaration
protected bool IsAggregateCatalogConfigured { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsInitialized
Declaration
public bool IsInitialized { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
KnownAssemblies
Declaration
public ISet<string> KnownAssemblies { get; }
Property Value
Type |
Description |
ISet<System.String> |
|
|
Improve this Doc
View Source
KnownFiles
Declaration
public IList<string> KnownFiles { get; }
Property Value
Type |
Description |
IList<System.String> |
|
Methods
|
Improve this Doc
View Source
Add(Assembly)
Declaration
public void Add(Assembly assembly)
Parameters
Type |
Name |
Description |
Assembly |
assembly |
|
|
Improve this Doc
View Source
Add(AssemblyCatalog)
Declaration
public void Add(AssemblyCatalog assemblyCatalog)
Parameters
Type |
Name |
Description |
AssemblyCatalog |
assemblyCatalog |
|
|
Improve this Doc
View Source
Add(ExportProvider)
Declaration
public void Add(ExportProvider exportProvider)
Parameters
Type |
Name |
Description |
ExportProvider |
exportProvider |
|
|
Improve this Doc
View Source
Add(Type)
Declaration
public void Add(Type type)
Parameters
Type |
Name |
Description |
Type |
type |
|
|
Improve this Doc
View Source
AddScanDirectories(IEnumerable<String>)
Declaration
public void AddScanDirectories(IEnumerable<string> directories)
Parameters
Type |
Name |
Description |
IEnumerable<System.String> |
directories |
|
|
Improve this Doc
View Source
AddScanDirectory(String)
Declaration
public void AddScanDirectory(string directory)
Parameters
Type |
Name |
Description |
System.String |
directory |
|
|
Improve this Doc
View Source
Declaration
protected virtual void Configure()
|
Improve this Doc
View Source
Dispose()
Declaration
|
Improve this Doc
View Source
Dispose(Boolean)
Implementation of the dispose pattern
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
bool
|
|
Improve this Doc
View Source
Export(Type, Object, IDictionary<String, Object>)
Declaration
public ComposablePart Export(Type type, object obj, IDictionary<string, object> metadata = null)
Parameters
Type |
Name |
Description |
Type |
type |
Type to export
|
System.Object |
obj |
object to add
|
IDictionary<System.String, System.Object> |
metadata |
Metadata for the export
|
Returns
Type |
Description |
ComposablePart |
ComposablePart, this can be used to remove the export later
|
|
Improve this Doc
View Source
Export(Type, String, Object, IDictionary<String, Object>)
Declaration
public ComposablePart Export(Type type, string contractName, object obj, IDictionary<string, object> metadata = null)
Parameters
Type |
Name |
Description |
Type |
type |
Type to export
|
System.String |
contractName |
contractName under which the object of Type T is registered
|
System.Object |
obj |
object to add
|
IDictionary<System.String, System.Object> |
metadata |
Metadata for the export
|
Returns
Type |
Description |
ComposablePart |
ComposablePart, this can be used to remove the export later
|
|
Improve this Doc
View Source
Export<T>(T, IDictionary<String, Object>)
Declaration
public ComposablePart Export<T>(T obj, IDictionary<string, object> metadata = null)
Parameters
Type |
Name |
Description |
T |
obj |
object to add
|
IDictionary<System.String, System.Object> |
metadata |
Metadata for the export
|
Returns
Type |
Description |
ComposablePart |
ComposablePart, this can be used to remove the export later
|
Type Parameters
Name |
Description |
T |
Type to export
|
|
Improve this Doc
View Source
Export<T>(String, T, IDictionary<String, Object>)
Declaration
public ComposablePart Export<T>(string contractName, T obj, IDictionary<string, object> metadata = null)
Parameters
Type |
Name |
Description |
System.String |
contractName |
contractName under which the object of Type T is registered
|
T |
obj |
object to add
|
IDictionary<System.String, System.Object> |
metadata |
Metadata for the export
|
Returns
Type |
Description |
ComposablePart |
ComposablePart, this can be used to remove the export later
|
Type Parameters
Name |
Description |
T |
Type to export
|
|
Improve this Doc
View Source
FindAndLoadAssemblies(IEnumerable<String>, Regex, Boolean)
Declaration
public void FindAndLoadAssemblies(IEnumerable<string> directories, Regex pattern, bool loadEmbedded = true)
Parameters
Type |
Name |
Description |
IEnumerable<System.String> |
directories |
|
Regex |
pattern |
|
System.Boolean |
loadEmbedded |
|
|
Improve this Doc
View Source
FindAndLoadAssemblies(String, Boolean, IEnumerable<String>)
Declaration
public void FindAndLoadAssemblies(string pattern = "*", bool loadEmbedded = true, IEnumerable<string> extensions = null)
Parameters
Type |
Name |
Description |
System.String |
pattern |
|
System.Boolean |
loadEmbedded |
|
IEnumerable<System.String> |
extensions |
|
|
Improve this Doc
View Source
FindAndLoadAssembliesFromDirectory(String, Regex, Boolean)
Declaration
public void FindAndLoadAssembliesFromDirectory(string directory, Regex pattern = null, bool loadEmbedded = true)
Parameters
Type |
Name |
Description |
System.String |
directory |
|
Regex |
pattern |
|
System.Boolean |
loadEmbedded |
|
|
Improve this Doc
View Source
FindAndLoadAssembliesFromDirectory(String, String, Boolean, IEnumerable<String>)
Declaration
public void FindAndLoadAssembliesFromDirectory(string directory, string pattern = "*", bool loadEmbedded = true, IEnumerable<string> extensions = null)
Parameters
Type |
Name |
Description |
System.String |
directory |
|
System.String |
pattern |
|
System.Boolean |
loadEmbedded |
|
IEnumerable<System.String> |
extensions |
|
|
Improve this Doc
View Source
FindAndLoadAssembly(String, IEnumerable<String>)
Declaration
public void FindAndLoadAssembly(string assemblyName, IEnumerable<string> extensions = null)
Parameters
Type |
Name |
Description |
System.String |
assemblyName |
|
IEnumerable<System.String> |
extensions |
|
|
Improve this Doc
View Source
GetAllInstances(Type)
Declaration
public IEnumerable<object> GetAllInstances(Type serviceType)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
Returns
Type |
Description |
IEnumerable<System.Object> |
|
|
Improve this Doc
View Source
GetAllInstances<TService>()
Declaration
public IEnumerable<TService> GetAllInstances<TService>()
Returns
Type |
Description |
IEnumerable<TService> |
|
Type Parameters
Name |
Description |
TService |
|
|
Improve this Doc
View Source
GetExport(Type, String)
Declaration
public object GetExport(Type type, string contractname = "")
Parameters
Type |
Name |
Description |
Type |
type |
|
System.String |
contractname |
|
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
GetExport<T>(String)
Declaration
public Lazy<T> GetExport<T>(string contractname = "")
Parameters
Type |
Name |
Description |
System.String |
contractname |
|
Returns
Type Parameters
|
Improve this Doc
View Source
GetExport<T, TMetaData>(String)
Declaration
public Lazy<T, TMetaData> GetExport<T, TMetaData>(string contractname = "")
Parameters
Type |
Name |
Description |
System.String |
contractname |
|
Returns
Type |
Description |
Lazy<T, TMetaData> |
|
Type Parameters
Name |
Description |
T |
|
TMetaData |
|
|
Improve this Doc
View Source
GetExports(Type, String)
Declaration
public IEnumerable<Lazy<object>> GetExports(Type type, string contractname = "")
Parameters
Type |
Name |
Description |
Type |
type |
|
System.String |
contractname |
|
Returns
Type |
Description |
IEnumerable<Lazy<System.Object>> |
|
|
Improve this Doc
View Source
GetExports<T>(String)
Declaration
public IEnumerable<Lazy<T>> GetExports<T>(string contractname = "")
Parameters
Type |
Name |
Description |
System.String |
contractname |
|
Returns
Type |
Description |
IEnumerable<Lazy<T>> |
|
Type Parameters
|
Improve this Doc
View Source
GetExports<T, TMetaData>(String)
Declaration
public IEnumerable<Lazy<T, TMetaData>> GetExports<T, TMetaData>(string contractname = "")
Parameters
Type |
Name |
Description |
System.String |
contractname |
|
Returns
Type |
Description |
IEnumerable<Lazy<T, TMetaData>> |
|
Type Parameters
Name |
Description |
T |
|
TMetaData |
|
|
Improve this Doc
View Source
GetInstance(Type)
Declaration
public object GetInstance(Type serviceType)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
GetInstance(Type, String)
Declaration
public object GetInstance(Type serviceType, string key)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
System.String |
key |
|
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
GetInstance<TService>()
Declaration
public TService GetInstance<TService>()
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
|
|
Improve this Doc
View Source
GetInstance<TService>(String)
Declaration
public TService GetInstance<TService>(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
TService |
|
Type Parameters
Name |
Description |
TService |
|
|
Improve this Doc
View Source
GetService(Type)
Declaration
public object GetService(Type serviceType)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
InitializeAsync(CancellationToken)
Initialize the bootstrapper
Declaration
public virtual Task<bool> InitializeAsync(CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
|
Improve this Doc
View Source
ProvideDependencies(Object)
Declaration
public void ProvideDependencies(object objectWithDependencies)
Parameters
Type |
Name |
Description |
System.Object |
objectWithDependencies |
|
|
Improve this Doc
View Source
RegisterForDisposal(IDisposable)
Declaration
public void RegisterForDisposal(IDisposable disposable)
Parameters
Type |
Name |
Description |
IDisposable |
disposable |
|
|
Improve this Doc
View Source
Release(ComposablePart)
Release an export which was previously added with the Export method
Declaration
public void Release(ComposablePart part)
Parameters
Type |
Name |
Description |
ComposablePart |
part |
ComposablePart from Export call
|
|
Improve this Doc
View Source
RunAsync(CancellationToken)
Start the bootstrapper, initialize if needed
Declaration
public virtual Task<bool> RunAsync(CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
|
Improve this Doc
View Source
StopAsync(CancellationToken)
Declaration
public virtual Task<bool> StopAsync(CancellationToken cancellationToken = null)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<System.Boolean> |
|
|
Improve this Doc
View Source
Unconfigure the AggregateCatalog
Declaration
protected virtual void Unconfigure()