If possible call dispose method on object which is created with ExportFactory?
Factory is here:
public interface IViewModelsControler
{
IChatViewModel CreatChatViewModel();
}
[Export(typeof(IViewModelsControler))]
public class ViewModelsControler:IViewModelsControler
{
[Import]
public ExportFactory<IChatViewModel> ChatViewFactory { get; set; }
public IChatViewModel CreatChatViewModel()
{
return ChatViewFactory.CreateExport().Value;
}
}
Creation of object:
var chatScreen = ViewModelControler.CreatChatViewModel();
I would like call chatScreen.Dispose().
ChatViewModel call look like this:
[Export(typeof(IChatViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class ChatViewModel : Screen, IChatViewModel
{}