Take a look at this code :
public class Program
{
[import]IMain Main {get; set;}
...
private Compose() {...}
}
internal interface IMain
{
...
}
[Export(typeof(IMain)]
public class Main : IMain
{
[import]
Interace1 Object1 {get;set;}
[import]
Interace2 Object2 {get;set;}
}
...
I want to lazy load Object2 after the composition beween Program and Main. When I compose in Program, I've a MEF error because MEF try to compose Object2 as well (but the implementation of Interface2 is not available at the begining... I want to load it after).
How can I do this ?
I've tried to put :
[import]
Lazy<Interace2> Object2 {get;set;}
but I still have the same trouble.