I encoded this service:
public interface IMyInterface
{
...
}
[Export(typeof(IMyInterface))]
internal class MyService : IMyInterface
{
...
}
Now I would like to import multiple instances MyServiceusing MEF in my main program.
How can i do this?
Since [Import] private IMyInterface MyService { get; set; }I get only 1 instance MyService. In my main program, I would like to dynamically indicate the number of imported instances MyServicebefore the MEF composition.
I do not want to use [ImportMany], because I do not want to indicate the amount of export in my implementation MyService.
Can you help me?
source
share