-
Notifications
You must be signed in to change notification settings - Fork 9
Platform specific: MEF aka System.Composition
The implementation complexity is hidden under the Kephas.Composition.Mef namespace, in the assembly with the same name.
This builder class is used to configure the composition container and add it to the ambient services. It extends the CompositionContainerBuilderBase from the core, providing MEF specific functionality.
Remarks: this class is normally not used as such, but through the
AmbientServicesBuilderextension methods (see below).
This static class provides convenience methods for initializing the composition container in the ambient services.
Warning: before initializing the composition container, the log manager and the application runtime must be set into the ambient services, otherwise the respective Null services will be used, which do not do anything meaningful.
var ambientServicesBuilder = await
new AmbientServicesBuilder()
.WithNLogManager()
.WithNet45AppRuntime(n => n.Name.ToLower().StartsWith("kephas.") || n.Name.ToLower().StartsWith("myapp."))
.WithMefCompositionContainerAsync()
.PreserveThreadContext();