Class AutofacCompositionContextBase
An Autofac composition context base.
Inherited Members
Namespace: Kephas.Composition.Autofac.Hosting
Assembly: Kephas.Composition.Autofac.dll
Syntax
public abstract class AutofacCompositionContextBase : ICompositionContext, IDisposable
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 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 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 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 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 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(ILifetimeScope)
Initializes a new instance of the AutofacCompositionContextBase class.
Declaration
protected void Initialize(ILifetimeScope container)
Parameters
Type | Name | Description |
---|---|---|
Autofac.ILifetimeScope | container | The inner container. |
TryGetExport(Type, String)
Tries to resolve the specified contract type.
Declaration
public 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 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. |