带有 Prism 4 的新 LOB Silverlight 4(mvvm、mef、unity)

发布于 2024-09-29 20:11:57 字数 235 浏览 0 评论 0 原文

我正在使用 Silverlight v4 和 WCF Ria 服务启动一个新的 LOB 应用程序。我们的想法是使用 Prism v4,其中包括 MVVM、MEF 和 Unity。

我可以一起使用这些“技术”:可以想象哪种架构场景?

编写一个框架来构建这种可重用的应用程序有意义吗?也许已经作为示例应用程序存在?

(Prism v4 中有很多示例项目,但没有一个包含所有“技术”)

提前致谢。

I'm starting a new LOB application with Silverlight v4 and WCF Ria Services. The idea is to use Prism v4, that includes MVVM, MEF and Unity.

Can I use all together these "technologies": which scenario of architecture can be imagined?

Makes sense to write a skeleton to build such kind of application that can be reused? Maybe already exist as sample application?

(in Prism v4 there are a lot of sample projects, but not one that includes all "technologies")

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烛影斜 2024-10-06 20:11:57

好吧,请记住 MEF 不会正式发布直到版本 4.0 发布之前,它们都是 Prism 的一部分(现在在 CTP 中),但它们绝对可以一起使用。另一方面,MVVM 严格来说并不是 Prism 的一部分:可以使用 Prism 和 MVVM,但也可以使用 Prism 而不使用 MVVM,反之亦然。

当您构建 Prism 应用程序时,为可重用的内容创建单独的模块始终是一个好主意。例如,如果您的应用程序通常解析 XML,您可以创建一个 Prism 模块来处理它,然后重新使用它。

此外,明智地利用 Prism 基础设施项目并将实用程序放置在那里始终是一个好主意,这些实用程序不够大,不值得拥有自己的模块,但可以重复使用,足以带到其他项目中。

找到一个充分利用 Prism 的项目并不容易,主要是因为 Prism 并不适合单个项目充分利用。 Prism 作为方法论菜单,您可以从该菜单中挑选那些将帮助您更好、更高效地构建项目的方法。

特别注意 Prism 中的 EventAggregator,这将为您提供广泛的事件广播功能。

Prism 中需要仔细研究的其他重要部分是 UI组合:RegionManager、RegionContext 和 Regions 的总体情况。

当您计划使用 MVVM 时,请确保充分了解 数据绑定适用于 Silverlight,请查看 转换器并深入了解命令以及如何使用它们和绑定它们,并确保您查看了 Prism 的 DelegateCommand

为了保持 UI 可重用和“可组合”,请确保使用 自定义控件行为 而不是在视图中编写代码隐藏。

我希望这个介绍有所帮助。你的问题相当笼统,因此很难确定你是否已经意识到所有这些事情。如果您需要除此之外的具体信息,请澄清。

Well, keep in mind that MEF won't be officially part of Prism until version 4.0 is released (it is in CTP right now), but they can definitely be used together. On the other hand MVVM is not strictly part of Prism: it is possible to use Prism and MVVM, but it is possible to use Prism and not use MVVM and vice-versa.

When you build a Prism application, it is always a good idea to create separate modules for things that are re-usable. For example, if your applications usually parse XML you could create a Prism module to handle that and then re-use it.

Also, it is always a good idea to make intelligent use of the Prism Infrastructure project and put there utilities which are not big enough to deserve a module of their own but are re-usable enough to be carried to other projects.

It is not easy to find a project that puts Prism to full use, mainly because Prism is not meant to be fully used by a single project. Prism works as a menu of methodologies, and from that menu you can pick and choose those that will help you build your project better and more efficiently.

Pay special attention to the EventAggregator in Prism, which will provide you with event broadcasting capabilites, application wide.

Other important portion of Prism to take a closer look at is UI Composition: RegionManager, RegionContext and Regions in general.

As you plan to make use of MVVM, make sure to have a good understanding of how Data Binding works in Silverlight, take a look at converters and dive deep into Commands and how to use them and bind them and make sure you take a look at Prism's DelegateCommand.

In order to keep your UI re-usable and "composable" make sure to encapsulate UI logic using custom controls and behaviors instead of writing code-behind in your views.

I hope this introduction helps. Your question was rather general and therefore it is hard to identify whether you are already aware of all these things or not. If you need specific information beyond this, please clarify.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文