Modules.
Modules are packages of functionality that can be independently developed, tested, and (optionally)
deployed. In many situations, modules are developed and maintained by separate teams. A typical Prism
application is built frommultiple modules. Modules can be used to represent specific business-related
functionality (for example, profile management) and encapsulate all the views, services, and data models
required to implement that functionality. Modules can also be used to encapsulate common application
infrastructure or services (for example, logging and exception management services) that can be reused across
multiple applications.
Module 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. The module catalog is used by the ModuleManagerand ModuleLoader
components, which are responsible for downloading the modules if they are remote, loading the module's
assemblies into the application domain, and for initializing the module. Prismallows the module catalog to be
specified in different ways, including programmatically using code, declaratively using XAML, or using a
configuration file. You can also implement a custommodule catalog if you need to Page 20.
Shell.
The shell is the host application into which modules are loaded. The shell defines the overall layout and
structure of the application, but it is typically unaware of the exact modules that it will host. It usually
implements common application services and infrastructure, but most of the application's functionality and
content is implemented within the modules. The shell also provides the top-level window or visual element that
will then host the different UI components provided by the loaded modules.
Views.
Views are UI controls that encapsulate the UI for a particular feature or functional area of the
application. Views are used in conjunction with the MVVM or Model-View-Presenter (MVP) patterns, which are
used to provide a clean separation of concerns between the UI and the application's presentation logic and
data. Views are used to encapsulate the UI and define user interaction behavior, thereby allowing the view to be
updated or replaced independently of the underlying application functionality. Views use data binding to interact
with view model and presenter classes.
View models and presenters. View models are classes that encapsulate the application's presentation logic
and state. They are part of the MVVM pattern. View models encapsulate much of the application's functionality.
Presenters are similar to view models in that they encapsulate the presentation logic and state. They are used
as part of the MVP pattern. Both view models and presenters define properties, commands, and events, to which
controls in the view can data-bind.
Models.
Model classes encapsulate the application data and business logic. They are used as part of the MVVM
or MVP patterns. Models encapsulate data and any associated validation and business rules to ensure data
consistency and integrity.
Commands.
Commands are used to encapsulate application functionality in a way that allows themto be
defined and tested independently of the application's UI. They can be defined as command objects or as
command methods in the view model or presenter. Prismprovides the DelegateCommandclass and the
CompositeCommandclass. The latter is used to represent a collection of commands which are all invoked
together.
Regions.
Regions are logical placeholders defined within the application's UI (in the shell or within views) into
which views are displayed. Regions allow the layout of the application's UI to be updated without requiring
changes to the application logic. Many common controls can be used as a region, allowing views to be
automatically displayed within controls, such as a ContentControl, ItemsControl, ListBox, or TabControl.
Views can be displayed within a region programmatically or automatically. Prismalso provides support for
implementing navigation with regions. Regions can be located by other components through the RegionManager
component, which uses RegionAdapterand RegionBehaviorcomponents to coordinate the display of views
within specific regions.
Navigation.
Navigation is defined as the process by which the application coordinates changes to its UI as a
result of the user's interaction with the application or internal application state changes. Prismsupports two
styles of navigation: state-based navigation, where the state of an existing view is updated to implement simple
navigation scenarios, and view-switching navigation, where new views are created and old views replaced within
the application's UI. View-switching navigation uses a UniformResource Identifier (URI)–based navigation
mechanismin conjunction with Prismregions to allow flexible navigation schemes to be implemented.
EventAggregator.
Components in a composite application often need to communicate with other components
and services in the application in a loosely coupled way. To support this, Prismprovides the EventAggregator
component, which implements a pub-sub event mechanism, thereby allowing components to publish events and
other components to subscribe to those events without either of themrequiring a reference to the other. The
EventAggregatoris often used to allow components defined in different modules to communicate with each
other.
Dependency injection container. The Dependency Injection (DI) pattern is used throughout Prismto allow the
dependencies between components to be managed. Dependency injection allows component dependencies to be
fulfilled at run time, and it supports extensibility and testability. Prismis designed to work with Unity or MEF, or
with any other dependency injection containers via the ServiceLocator.
Services.
Services are components that encapsulate non-UI related functionality, such as logging, exception
management, and data access. Services can be defined by the application or within a module. Services are
often registered with the dependency injection container so that they can be located or constructed as required
and used by other components that depend on them.
Controllers.
Controllers are classes that are used to coordinate the construction and initialization of views that
are to be displayed in a region within the application's UI. Controllers encapsulate the presentation logic that
determines which views are to be displayed. The controller will use Prism's view-switching navigation mechanism,
which provides an extensible URI-based navigation mechanismto coordinate the construction and placement of
views within regions. The Application Controller pattern defines an abstraction that maps to this responsibility.
Bootstrapper.
The Bootstrappercomponent is used by the application to initialize the various Prism
components and services. It is used to initialize the dependency injection container to register any
application-level components and services with it. It is also used to configure and initialize the module catalog
and the shell's view and view model or presenter.
Multi-targeting.
Prismsupports the development of applications that can target both WPF and Silverlight. By
adopting a separated presentation pattern, such as the MVVM or MVP patterns, you can separate the UI of your
application fromits presentation and business logic. View model, presenter, and model classes can be reused in
both WPF and Silverlight versions of the same application. WPF-specific and Silverlight-specific views can then
be defined in a way that encapsulates the UI for each.