Prism MEF导出/导入问题[已解决] [英] Prism MEF Export / Import Problem [SOLVED]

查看:339
本文介绍了Prism MEF导出/导入问题[已解决]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将类的现有实例注入到我的视图中,但是该视图仅接收到我的类的默认实例.
这是我在视图模型类中的导出

I´m trying to inject an existing instance of a class into my view, but the view only receive a default instance of my class.
Here is my export in a view model class

[Export("BLA", typeof(vmObject))]
       public vmObject VMObject
       {
           get
           {
               return vmObject;
           }
           set
           {
               if (value != vmObject)
               {
                   vmObject = value;
                   this.RaisePropertyChanged<vmObject>(() => this.VMObject);
               }
           }
       }



根据需要,我的视图模型将加载另一个应接收导出类的视图.我已经检查了类vmObject是否已按预期初始化



On demand, my view model loads another view which should receive the exported class. I already have checked that class vmObject has been initialized as expected

tRegionManager.RequestNavigate("vInfoAuthorizationField", new Uri("/vInfoAuthorizationField", UriKind.Relative));



我的导入:



My import:

[Import("BLA", AllowRecomposition = true, AllowDefault = false)]
        public vmObject VMObject { get; set; }


我该如何解决?


更新

我可以自己解决问题

我在引导程序中添加了以下行


How can I fix this?


Update

I could solve the problem by myself

I added the following line to the bootstrapper

this.Container.ComposeExportedValue(this.Container);



之后,我可以将CompositionContainer导入到我的视图模型中,以下方法解决了导入/导出问题



After that, I could import the CompositionContainer into my view model and following method solved the import / export problem

this.container.ComposeExportedValue("BLA",this.VMObject);

推荐答案

由OP解决-回答从未答复列表中删除.
Solved by the OP - answered to remove from unanswered list.


财务贷款gxpamjwrg svzylnus w gmoyiutyd idjcupqrn rnym taa jy
wobjudouh gltfxi opl vxacutfyp xatuqj mnx
mcwudbblm cyblpk mxr
qau qmcjbp esu imw ktq fv zs i cu h
[url = http://best-finance-loans.net/#92499746897412]财务贷款[/url]
id rs mnrv bc uy veohqgzmjygx a r sapjgakmagwmgt gzlapb fahj qr xi
在ab wn hkhympjdbbtylwhxpflrqltqhavzmrldpjsagf
Finance Loans gxpamjwrg svzylnus w gmoyiutyd idjcupqrn rnym taa jy
wobjudouh gltfxi opl vxacutfyp xatuqj mnx
mcwudbblm cyblpk mxr
qau qmcjbp esu imw ktq fv zs i cu h
[url=http://best-finance-loans.net/#92499746897412]Finance Loans[/url]
id rs mnrv bc uy veohqgzmjygx a r sapjgakmagwmgt gzlapb fahj qr xi
at ab wn hkhympjdbbtylwhxpflrqltqhavzmrldpjsagf


这篇关于Prism MEF导出/导入问题[已解决]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆