Runtime: Support equivalent of ComposeExportedValue in System.Composition

Created on 19 Sep 2016  路  10Comments  路  Source: dotnet/runtime

System.ComponentModel.Composition (MEF1) has the ability to supply imports to an already-instantiated object, via the ComposeExportedValue<T>(T exportedValue) method. As requested by @ZigMeowNyan and @jabbera in dotnet/runtime#15362, it would be useful to have this ability in System.Composition (MEF2).

api-needs-work area-System.Composition untriaged

Most helpful comment

Add methods to ContainerConfiguration class:

c# public ContainerConfiguration WithInstance<TExport> (TExport instance); public ContainerConfiguration WithInstance<TExport> (string contractName, TExport instance); public ContainerConfiguration WithInstance (Type t, object instance); public ContainerConfiguration WithInstance (Type t, string contractName, object instance);

All 10 comments

We need formal API proposal

Add methods to ContainerConfiguration class:

c# public ContainerConfiguration WithInstance<TExport> (TExport instance); public ContainerConfiguration WithInstance<TExport> (string contractName, TExport instance); public ContainerConfiguration WithInstance (Type t, object instance); public ContainerConfiguration WithInstance (Type t, string contractName, object instance);

Just adding a +1 to this request. Heavily reliant on ComposeExportedValue and without it, or a sensible workaround, will have to completely redesign my system in order to port to .Net Core

This is very frustrating lack of functionality, I join @siobhanc in his comment

+1 for this

+1 (Surprised nothing has happened after 2.5 years!)

Nobody has made a formal API proposal. Guidelines for the format are in the docs folder in this repo. Then the API board can review. If approved, we would welcome a PR with tests from the community.

@danmosemsft Care to provide a direct link to the guideline?

I believe this is now tracked with #29400

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aggieben picture aggieben  路  3Comments

omariom picture omariom  路  3Comments

btecu picture btecu  路  3Comments

chunseoklee picture chunseoklee  路  3Comments

nalywa picture nalywa  路  3Comments