棱镜模块依赖

时间:2013-03-14 10:35:28

标签: wpf prism

我正在使用prism开发一个应用程序,在那个应用程序中我可以使用模块类。然后我有其他模块需要使用这类模块。我遇到的问题是我的消费者模块在它需要的模块类之前被初始化,因此UnityContainer中不存在类型注册。

我发现这篇文章Module dependencies in InitializeShell with Prism表明我可以使用ModuleDependency属性来设置这种链接,但它似乎没有用。

所以我的存储类为:

[Module(ModuleName = "StorageModule")]
public class UserStorageModule : IModule
{
   //code here
}

然后消费者:

[ModuleDependency("StorageModule")]
public class EntryModule : IModule
{
   //code here
}

但是仍然首先调用EntryModule.Initialize()方法。我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

过早放弃搜索的课程。一些更多的搜索揭示了这个解决方案

How to control the order of module initialization in Prism

这似乎很好地解决了我的问题。