MefInjection<TService,TInterface> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Extenders using the VisualStudio.Extensibility model to develop in-process extension can use MefInjection<TService,TInterface> to retrieve MEF services through .NET dependency injection.
public class MefInjection<TService,TInterface> where TService : class
type MefInjection<'Service, 'Interface (requires 'Service : null)> = class
Public Class MefInjection(Of TService, TInterface)
Type Parameters
- TService
The type that defines the service. TService
is passed to GetService<T>() when retrieving the service.
- TInterface
The expected type of the retrieved service.
The value returned by GetService<T>() is cast to TInterface
.
- Inheritance
-
MefInjection<TService,TInterface>
- Derived
Remarks
Extensions should retrieve instances of this type through dependency injection. This class should be used only when exactly one instance of TService
exists in the composition container.
Constructors
MefInjection<TService,TInterface>(AsyncServiceProviderInjection<SComponentModel,IComponentModel>) |
This constructor is for internal use only. Creates an instance of MefInjection<TService,TInterface>. |
Methods
GetServiceAsync() |
Asynchronously returns the retrieved service. |