可能であれば、ExportFactoryで作成されたオブジェクトに対してメソッドを呼び出しますか?MEFの問題 - ExportFactory <T> - 呼び出しDisposeメソッド
工場はここにある:オブジェクトの
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;
}
}
作成:
var chatScreen = ViewModelControler.CreatChatViewModel();
私はchatScreen.Disposeを呼び出したいと思います()。このような
ChatViewModelコールルック:
[Export(typeof(IChatViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
public class ChatViewModel : Screen, IChatViewModel
{}
誰かがこの投稿を編集できるので、コードはブロックテキストではありませんか? – IAbstract
@dboarmanそんなの? – jcolebrand