What is the Need of Prism and Composite Applications in .NET?


What is the Need of Prism and Composite Applications in .NET?

Prism is used to design and build rich, flexible, and easy-to-maintain Windows Presentation Foundation (WPF) desktop applications. Prism helps you to make WPF application with loosely coupled components and these components can be easily integrated into the main application. These types of applications are known as composite applications. 

Prism is also used in Silverlight and Windows Phone 7 applications.

Advantages of Prism and Composite Applications

1.  Prism helps in creating an application from modules that can be built, assembled / integrated, and, optionally, deployed by independent teams using WPF or Silverlight.

2. Minimize cross-team dependencies and allow teams to specialize in different areas, such as user interface (UI) design, business logic implementation, and infrastructure code development.

Components of Prism and Composite Applications

1. Shell: The shell is the host application into which modules are loaded. The shell provides the top-level window or visual element that will then host the different UI components provided by the loaded modules.

2. Regions. Regions are logical placeholders defined within the the Shell into which views of Modules are displayed. 

3. Modules: Modules are packages of functionality that can be independently developed, tested, and deployed. The module contains the views and services specific to a piece of the application's functionality. 

Modules use shell's regions for placing content. During initialization, modules use the RegionManager to locate regions in the shell and add one or more views to those regions or register one or more view types to be created within those regions. 

4. Catalog: In a composite application, modules must be discovered and loaded at run time by the host application. In Prism, a module catalog is used to specify which modules to are to be loaded, when they are loaded, and in what order.

5. Bootstrapper: The bootstrapper is used to connect the application with the Prism Library and the Unity or MEF containers and initialize them.

Prism Library source code includes the source code for the Prism Library assemblies, including the core Prism functionality, plus Unity and MEF extensions, which provide additional components for using Prism with the Unity Application Block (Unity) and the Managed Extensibility Framework.