Since I have multi threaded application, I need to get new instance of composed part every time.
I have one class called ClassA Which is being composed in RegisterComponents class as under:
public class ClassA : IClassA
// Some logic goes here...
public class RegisterComponents
public VitalsModule(CompositionContainer container)
this.container = container;
public void RegisterServices()
Now I am getting instance of ClassA into another class ClassB which is being called by multiple threads. I want new instance of
ClassA every time I get it from CompositionContainer.
public void ClassB
// this way i m getting lazy export
var lazyInstance = CompositionContainerHost.CompositionContainer.GetExport<IClassA>();
// Now i m creating instance of this export
// Here i need new instance every time...
var instance = lazyInstance.Value; //
But here I am not getting new instance every time and ClassA constructor will not get called every time.
Thanks in Advance.