Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: Associate a specific instance with an export

$
0
0
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.Container.Compose(compositionBatch);
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?

Viewing all articles
Browse latest Browse all 265

Trending Articles