Prism / Mef 目录 目录 SatisfyImports
在我的应用程序中,我有一个模块,我直接从 shell 引用该模块(就在我开始工作时)。
即
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(MyModule).Assembly));
}
在我的模块中,当我为视图调用 SatisfyImportsOnce 时,这已经起作用,我可以看到正在创建的视图模型等。
但是,我现在已更改引导程序以对我的模块使用directoryCatalog。我添加了一些构建后事件以将模块程序集、pdb 等复制到 shell。
所以现在我的引导程序中有以下内容,
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
// add the directory catalog for the modules
AggregateCatalog.Catalogs.Add(new DirectoryCatalog("Modules"));
}
我现在可以运行我的应用程序并查看模块中的视图,但以前可以工作的 SatisfyImportsOnce 现在似乎什么也没做。我看不到任何错误。既然我正在使用目录编目,我的导入/导出是否需要不同的属性?
谢谢。
In my app I have a module that I have been referencing direct from the shell (just while I get things working).
i.e.
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(MyModule).Assembly));
}
In my module when I've been calling SatisfyImportsOnce for a view this has worked and I can see the view model etc being created.
However, I have now changed my bootstrapper to use a directoryCatalog for my module. I have added some post build events to copy my module assembly, pdb etc to the shell.
So now I have the following in my bootstrapper
protected override void ConfigureAggregateCatalog()
{
base.ConfigureAggregateCatalog();
AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
// add the directory catalog for the modules
AggregateCatalog.Catalogs.Add(new DirectoryCatalog("Modules"));
}
I am now able to run my app and see the views from my module but the SatisfyImportsOnce that used to work now seems to do nothing. I can't see any errors. Are there different attributes I need on my imports / exports now that I'm using the directory catalog?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您需要使用的属性不应该有任何差异。
很难说出什么问题,这里有一篇关于一般的博客文章 MEF 调试。
No, there shouldn't be any difference in the attributes you need to use.
It's hard to tell what's wrong, here's a blog post on general MEF debugging.