651.288.7000 info@intertech.com

In the world of Windows Presentation Foundation (WPF) or Silverlight, Prism is a set of assets that helps you build modular enterprise applications.  Often, these applications contain rich user interfaces and evolve over time as business requirements evolve.  Prism can improve your ability to deliver consistent, maintainable, and industry-standard software.  Here are 7 things you absolutely need to know about Prism before venturing into your first Prism project.

1.    Prism has had different product names

Prism was an early “code name” for the Composite Application Library (CAL), but then it was renamed to Composite Application Guidance for WPF and Silverlight.  That’s a mouthful.  Now it’s renamed again to Prism, probably for the better.

2.    Prism is on CodePlex

You can obtain Prism from CodePlex at http://compositewpf.codeplex.com/.  Earlier versions of Prism required you to download files from both CodePlex and MSDN, but thankfully it is simpler now.  You can download all the requisite libraries, source code, and documentation from the CodePlex site above.

3.    Prism has many assets

Prism is a collection of library source code (that can be modified or extended if needed), signed binaries, extensions to the Unity Application Block and Managed Extensibility Framework (MEF), reference implementations, quick starts, and documentation.  The CodePlex site also offers additional material in the form of blogs, knowledge base, and known issues.  Finally, many industry professionals, including Intertech Consultants, have written articles, blogs, white papers, and sample programs to help you learn the various aspects of Prism.

4.    Prism has multiple versions

The current production version of Prism is 2.2, which was released in May 2010.  The next release of Prism is 4.0, which is currently in Beta (drop 10).  Both versions (and earlier releases also) can be downloaded from the link provided above.  There is no Prism version 3.x.

If you’re looking to build and release a new Prism WPF (or Silverlight) application soon, then Prism 2.2 is the better choice given its stable status.  Prism 4.0 is planned for industry release in the Fall of 2010, meaning it may be your better option if you’re planning or soon beginning a new Prism WPF project.  Both of these versions target either WPF or Silverlight applications developed with Visual Studio 2010 using .NET Framework 3.5 SP1 or 4.0 as the baseline framework.  If your project doesn’t align with those requirements, then an earlier version of Prism is probably a better choice.

5.    Prism provides choices

Prism has many great pieces of functionality, but you don’t need to use all of them.  It’s like the people you friend on Facebook, or the food you eat from a buffet, you get to choose what pieces of Prism are appropriate for your application.  If you like the concept of user interface composition but nothing else, that’s fine – use that only.  If you don’t want to leverage any Prism functionality except the Event Aggregator, go for it.  You choose what’s right for each project.

From an architectural perspective, Prism provides the following options

  • Bootstrapper – this provides application initialization
  • Shell and Shell Presenter – these provide the general visual layout structure and behavior for an application
  • Regions – these provide placeholders for visual content and enable composite views
  • Modules – these plug-ins enforce vertical or horizontal slices (or both) in an application, and enforce adherence to your chosen Presentation Model pattern
  • Views – these provide the content to display on the screen
  • Synchronous Communication – via commands
  • Asynchronous Communication – via event aggregation or services
  • Services – these provide either module-specific or shared-use functionality
  • Multi-targeting – this provides ability to use the same code base to deploy as either a WPF or Silverlight application

6.    Prism employs patterns

Most enterprise applications initially require or evolve to a point where common patterns are employed to provide application maintainability, performance, decoupling, etc.  Prism applications also employ patterns, many of which are supported directly in the Prism libraries or reference implementations.  Some of the key patterns you should know/learn include:

  • Controller
  • Dependency Injection / Inversion of Control
  • Event Aggregator
  • Façade
  • Plug-in
  • Presentation Model – either Model-View-ViewModel (MVVM) or Model-View-Presenter (MVP)
  • Repository
  • Service Locator

7.    Upgrading Prism 2.x applications to Prism 4.0 is not seamless

Prism 4.0 changed and deleted some namespace and assembly names, meaning you’ll need to adjust your Prism library references accordingly.  Here’s a brief summary of changes (realizing that 4.0 is not yet final release and this info could change).

Microsoft.Practices.Composite namespace changed to Microsoft.Practices.Prism across all assemblies

Composite.Presentation namespace deleted and its classes moved to Microsoft.Practices.Prism namespace

Prism 4.0 added a new XAML XmlnsDefinition of http://www.codeplex.com/prism.   Although the existing XmlnsDefinition of http://www.codeplex.com/CompositeWPF still exists, it is recommended that the new one be used.  We’re assuming that the existing definition will eventually be deleted permanently.

The bootstrapper is enhanced in Prism 4.0 to better enable use of Unity or MEF.  If you are using the UnityBootstrapper class, it is now derived from a new Bootstrapper base class in the Microsoft.Practices.Prism assembly.  Additionally, some property names and method names were changed.  Here’s a brief summary of changes (realizing that 4.0 is not yet final release and this info could change).

LoggerFacade property renamed to Logger

GetModuleCatalog method renamed to CreateModuleCatalog

ConfigureModuleCatalog was added

ConfigureServiceLocator was added

There are other library changes affecting the module catalog, regions, and event aggregator that may impact your effort required to upgrade a Prism 2.x application to 4.0.  The Prism 4.0 release documentation and API reference would be good starting points for more information.

It can be a little daunting to get started on a Prism application.  Start small, know your requirements, and preferably do a prototype to get your feet wet with the technology.  Intertech Consultants have implemented several real-life Prism applications for WPF and Silverlight; give us a call to help you guarantee your application’s success.

Pin It on Pinterest

Share This

Like What You've Read?

Subscribe to the Blog.

Every Friday we send that week's content from our Developers via email. Try it out!

Some ad blockers can block the form below.

You have Successfully Subscribed!