This project has moved and is read-only. For the latest updates, please go here.

Associate a specific instance with an export

Jul 10, 2014 at 8:08 PM
I'm attempting to move to MEF 2 and having trouble with some of the analogs. In MEF, you could compose a type and add it to the dictionary using a CompositionBatch like so:
    // Add the shared RootURI of the main page of the application to the composition container.
    CompositionBatch compositionBatch = new CompositionBatch();
    compositionBatch.AddExportedValue<Uri>("RootUri", new Uri(@"pack://application:,,,/Teraque.LicenseManager.License;/Teraque.LicenseManager.FrameView"));
This could then be referenced by getting:
    Uri uri = compositionContainer.GetExportedValue<Uri>("RootUri");
How do add a pre-constructed value into the composition container so it can be referenced in MEF 2? That is, what is the corresponding operation?