Class MefCompositionContextBase
A MEF composition context.
Inheritance
Inherited Members
Namespace: Kephas.Composition.Mef.Hosting
Assembly: Kephas.Composition.Mef.dll
Syntax
public abstract class MefCompositionContextBase : ICompositionContext, IDisposable
Properties
| Improve this Doc View SourceIsRoot
Gets a value indicating whether this object is root.
Declaration
protected virtual bool IsRoot { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if this object is root, false if not. |
Methods
| Improve this Doc View SourceAssertNotDisposed()
Asserts that the container is not disposed.
Declaration
protected void AssertNotDisposed()
CreateScopedContext()
Creates a new scoped composition context.
Declaration
public virtual ICompositionContext CreateScopedContext()
Returns
Type | Description |
---|---|
ICompositionContext | The new scoped context. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
GetExport(Type, String)
Resolves the specified contract type.
Declaration
public virtual object GetExport(Type contractType, string serviceName = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | contractType | Type of the contract. |
System.String | serviceName | The service name. |
Returns
Type | Description |
---|---|
System.Object | An object implementing |
GetExport<T>(String)
Resolves the specified contract type.
Declaration
public virtual T GetExport<T>(string serviceName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | serviceName | The service name. |
Returns
Type | Description |
---|---|
T | An object implementing |
Type Parameters
Name | Description |
---|---|
T | The service type. |
GetExports(Type)
Resolves the specified contract type returning multiple instances.
Declaration
public virtual IEnumerable<object> GetExports(Type contractType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | contractType | Type of the contract. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Object> | An enumeration of objects implementing |
GetExports<T>()
Resolves the specified contract type returning multiple instances.
Declaration
public virtual IEnumerable<T> GetExports<T>()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | An enumeration of objects implementing |
Type Parameters
Name | Description |
---|---|
T | The service type. |
Initialize(CompositionContext)
Initializes a new instance of the MefCompositionContextBase class.
Declaration
protected void Initialize(CompositionContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Composition.CompositionContext | context | The inner container. |
TryGetExport(Type, String)
Tries to resolve the specified contract type.
Declaration
public virtual object TryGetExport(Type contractType, string serviceName = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | contractType | Type of the contract. |
System.String | serviceName | The service name. |
Returns
Type | Description |
---|---|
System.Object | An object implementing |
TryGetExport<T>(String)
Tries to resolve the specified contract type.
Declaration
public virtual T TryGetExport<T>(string serviceName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | serviceName | The service name. |
Returns
Type | Description |
---|---|
T | An object implementing |
Type Parameters
Name | Description |
---|---|
T | The service type. |