WPF 的棱镜是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6273357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is Prism for WPF?
提问by Noldorin
I've come across something called Prisma lot recently. Microsoft, who run the project, describe it as
我最近经常遇到一种叫做棱镜的东西。运行该项目的微软将其描述为
Guidelines for composite applications in WPF and Silverlight.
WPF 和 Silverlight 中的复合应用程序指南。
Even after reading the more detailed descriptions out there, I have next to no clue what it's actually about, I'm afraid.
恐怕即使在阅读了更详细的描述之后,我也几乎不知道它实际上是关于什么的。
I'm hoping here that someone could give me a clear succinct explanation of what Prism actually is and why I should learn it. I have been a WPF developer for a couple of years now, used MVVM my fair share, and have lately encountered people using Prism, but personally feel a bit out of the loop here.
我希望在这里有人可以给我一个清晰简洁的解释 Prism 实际上是什么以及我为什么应该学习它。我已经成为 WPF 开发人员几年了,使用 MVVM 我公平的份额,并且最近遇到了使用 Prism 的人,但我个人觉得这里有点不合时宜。
In particular, I'm wondering about the following points:
特别是,我想知道以下几点:
Is Prism literally just (or mainly) a booklet, as given on the MSDN site? Does it include any libraries, if so for what exactly?
Is Prism an MVVM framework? Should I be using it as the "official Microsoft MVVM framework" over others out there or my own?
Does it provide dependency injection? Does it relate to MEF at all in this way?
Anything else I should know about what Prism does, as a WPF/Silverlight developer.
棱镜实际上只是(或主要)是MSDN 站点上提供的小册子吗?它是否包含任何库,如果包含,究竟是什么?
Prism 是 MVVM 框架吗?我应该将它用作“官方 Microsoft MVVM 框架”而不是其他人还是我自己的框架?
它提供依赖注入吗?它是否以这种方式与 MEF 相关?
作为 WPF/Silverlight 开发人员,我还应该了解 Prism 的作用。
采纳答案by Reed Copsey
Prism is the Microsoft Patterns and Practices Teamofficial guidance for building "composite applications" in WPF and Silverlight.
Prism 是Microsoft 模式和实践团队的官方指南,用于在 WPF 和 Silverlight 中构建“复合应用程序”。
Its intended to provide guidance on the best practices for building large scale applications which are flexible in terms of development and maintainability.
它旨在为构建大型应用程序的最佳实践提供指导,这些应用程序在开发和可维护性方面具有灵活性。
This includes guidance on dependency injection (via Unity or MEF), layout (including using MVVM), composite event handling, etc.
这包括关于依赖注入(通过 Unity 或 MEF)、布局(包括使用 MVVM)、复合事件处理等的指导。
Is Prism literally just (or mainly) a booklet, as given on the MSDN site? Does it include any libraries, if so for what exactly?
棱镜实际上只是(或主要)是 MSDN 站点上提供的小册子吗?它是否包含任何库,如果包含,究竟是什么?
It is a book, but also includes the libraries for support (on the GitHubsite).
这是一本书,但也包括支持库(在GitHub站点上)。
Is Prism an MVVM framework? Should I be using it as the "official Microsoft MVVM framework" over others out there or my own?
Prism 是 MVVM 框架吗?我应该将它用作“官方 Microsoft MVVM 框架”而不是其他人还是我自己的框架?
Yes and no. It includes guidance for using MVVM, but is far more than an MVVM framework. It's really not, in and of itself, an "MVVM framework" - though it does include MVVM guidance.
是和否。它包括使用 MVVM 的指南,但它不仅仅是一个 MVVM 框架。它本身并不是一个“MVVM 框架”——尽管它确实包含了 MVVM 指导。
Does it provide dependency injection? Does it relate to MEF at all in this way?
它提供依赖注入吗?它是否以这种方式与 MEF 相关?
Yes. It originally included Unity, but the latest release includes using MEF for DI.
是的。它最初包括 Unity,但最新版本包括将 MEF 用于 DI。
Anything else I should know about what Prism does, as a WPF/Silverlight developer.
作为 WPF/Silverlight 开发人员,我还应该了解 Prism 的作用。
It's worth taking a look at how they do things. They have a very elaborate "region" concept, as well as good event aggregation support. It also includes good practices for developing against WPF, Silverlight, and Windows Phone simulataneously.
值得一看他们是如何做事的。他们有一个非常精细的“区域”概念,以及良好的事件聚合支持。它还包括针对 WPF、Silverlight 和 Windows Phone 同时进行开发的良好实践。
回答by rboarman
It's a framework for building WPF and Silverlight apps.
它是用于构建 WPF 和 Silverlight 应用程序的框架。
http://compositewpf.codeplex.com/
http://compositewpf.codeplex.com/
It used to be called "Prism" before Microsoft renamed it to "CompositeWPF."
在微软将其重命名为“CompositeWPF”之前,它曾经被称为“Prism”。
Answers:
答案:
1) Prism is an MVVM framework to use as a foundation for your applications
1) Prism 是一个 MVVM 框架,用作应用程序的基础
2) I suggest so depending on your specific requirements. You should post another question with specific details so you can get some specific answers.
2)我建议根据您的具体要求。您应该发布另一个包含具体细节的问题,以便您可以获得一些具体的答案。
3) Prism uses dependency injection (Unity) but does not "provide" it
3)Prism使用依赖注入(Unity)但不“提供”它
4) Imo, Prism provides a lot of functionality but is heavy on the learning curve. For small projects with you as the sole developer, you may not need the abstraction and tools that it provides.
4) Imo,Prism 提供了很多功能,但学习曲线很重。对于您作为唯一开发人员的小型项目,您可能不需要它提供的抽象和工具。