Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there

I have a class decorated with the ImportingConstructor attribute as follows:

[ImportingConstructor]
public MyClass([Import("Path")]string path, [Import("Key")]string key)

and can create an instance using CompositionContainer.GetExportedValue and
CompositionContainer.ComposeExportedValue to set the parameters.

However this only works for a first instance of the MyClass as CompositionContainer.ComposeExportedValue errors trying to create a new export which already exists.

Can anyone tell me how to set the import parameters for multiple instances of MyClass?

Thanks very much
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900