Prism 模块 - 为什么我需要它们
对于使用 MEF 目录的中型应用程序,我使用 Prism 模块确实有任何优势,而不是仅仅将不同的功能放入不同的类库中。我只是不明白为什么我需要使用模块。
有人对此有什么想法吗?
谢谢,
理查德
For a mid sized application that makes use of MEF catalogs is there really any advantage in my using Prism modules rather than just putting the different functionality into different class libraries. I just can't see why I would need to use Modules.
Anyone have any thoughts on this?
Thanks,
Richard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当您想要在加载模块时执行初始化操作时,可以使用模块。例如,这可以是使用 Prism IRegionManager 接口将视图注册到区域。
Modules are used when you want to perform initialization actions when the module is loaded. This can be for example the registration of views to regions using the Prism IRegionManager interface.
PVitt 说的是正确的,我想补充一下。
对于可扩展性来说,模块始终是一个不错的选择。
您可以通过区域轻松地进行未来的增强,每个区域都有一些与其关联的视图,并且每个视图位于不同的模块中。
当我说不同模块中的每个视图时,这意味着您应该找出哪个视图具有与其相关的其他视图,并为这两个视图创建一个俱乐部视图,并为这些视图提供单个模块。毕竟这是你的决定。
例如,考虑您的应用程序有一个菜单。每个菜单项的工具栏都是相同的,即具有相同的功能,那么您可以在“MenuView”内拥有 ToolbarView+Menuview。MenuModule 将具有最终的 MenuView。
因此,如果您未来有任何增强功能,或者您的项目将不时发生变化(例如根据用户需求添加新功能等),我的选择是采用模块化方法。
What PVitt says is correct plus i would like to add to it.
Modules are always a good option for the scalability.
you can easily do future enhancements by having Regions,each region having some view associated with it and each view in different module.
when i say each view in different module it means you should find out which view is having some other view related to it and make a clubed view of these two views and have single module for these views. after all its your call.
for e.g.consider your application has a menu.Toolbar for each menu item is same i.e. having same functionality then you can have ToolbarView+Menuview inside "MenuView".MenuModule will have this final MenuView.
So my opion is go with modular approach if you have any future enhancement or if your project is going to change time to time like new functionalities on user demand etc.
模块是允许多个开发团队同时开发的绝佳方式。还帮助您在项目级别组织和维护 SOLID 原则的单一职责原则。
它可以帮助您分离关注点。
Modules are a wonderful way to allow multiple development teams to develop at the same time. Also assist your to organize and maintain the Single Responsibility principle of SOLID principles in a Project level.
It helps your to have separation of concerns.