Wednesday, September 17, 2014

What's New In Prism 5.0?


Are you WPF, Silverlight or Windows Phone developer and used Microsoft’s patterns and practices library to build your applications? If you are, then you might want to know that Microsoft’s patterns and practices team have just released Prism 5.0. All the applications built using the previous versions of Prism are now broken. So, in this artifact, I’ll be discussing about the new assemblies, new objects and deprecated objects which can/can’t be used with Prism 4.1 and Prism 5.0.
Downloading Prism 5.0

Prism 5.0 can be downloaded and installed either from patterns and practices site having URL as http://compositewpf.codeplex.com/ or by using Nuget package inside Visual Studio. Mentioned link also discusses about all the changes which are part of Prism 5.0

Supported Platforms
Let’s have a quick look at the supported platforms of Prism 5.0. While working with previous versions of Prism (i.e. 4.1), one was able to create applications like WPF (.Net 4.0), Silverlight 5 and Windows Phone (7.5). Point to note here is, Prism 5.0 only supports WPF (.Net 4.5).

Prism 4.1
Prism 5.0
WPF (.Net 4.0)
WPF(.Net 4.5)
Silverlight 5
 
Windows Phone (7.5)
 

 
In other words, if your application is written in Silverlight or Windows Phone and you are planning to upgrade to Prism 5.0, then it’s not going to work. In this case, either you have to use some tool and make your application as WPF application (if possible) or simply stick to the existing version of Prism.
Assembly Changes

This section discusses about all the assembly related changes that Prism 5.0 introduces. Please note, in below table all the assemblies are prefixed with Microsoft.Practices:

Prism 4.1
Prism 5.0
Prism
Prism.Composition [Renamed]
Prism.Interactivity
Prism.Interactivity [No change here]
ServiceLocation
ServiceLocation [No change here]
Unity
Unity [It is now a PCL]
Prism.UnityExtensions/Mef
Prism.UnityExtensions
 
Prism.SharedInterfaces [Is is also a PCL]
 
Prism.MVVM [It is also a PCL]
 
Prism.MVVM.Desktop
 
Prism.PubSubEvents [It is also a PCL]


If you will see above table, the assembly named Microsoft.Practices.Prism in Prism 4.1 is no longer called Microsoft.Practices.Prism in Prism 5.0. Now this assembly is renamed to Prism.Composition.
There is no change in Prism.Interactivity, ServiceLocation, Prism.UnityExtensions and Prism.MefExtensions front.

This Prism.Composition takes dependency on another new assembly called Prism.SharedInterfaces, which is a PCL (Portable Class Library).
On MVVM front, there are two more additions. One is Prism.MVVM which is again a PCL and shares a common MVVM functionality across Windows Store Apps and Windows Presentation Foundation applications. Now to get around of few limitations and some needed enhancements on WPF, a separate assembly is created having name as Prism.MVVM.Desktop, which is specifically meant to be used on desktop.

One more addition is Prism.PubSubEvents. This is event aggregator. So, event aggregator is called out of Prism and has been kept into its own PCL library in Prism 5.0

Deprecated Objects
Deprecated objects are the objects which are still in assemblies but we just don’t want to use them anymore and if you are currently using them, then you have to move them to different object instance. Below is the list of such objects:



Object

Use

NotificationObject

Microsoft.Practices.Prism.MVVM.BindableBase class

in

Microsoft.Practices.Prism.MVVM.dll

PropertySupport

Microsoft.Practices.Prism.MVVM.PropertySupport class

in

Microsoft.Practices.Prism.MVVM.dll

CompositePresentationEvent

Microsoft.Practices.Prism.PubSubEvents.PubSubEvent class

in

Microsoft.Practices.Prism.PubSubEvents.dll

Objects moved to new location

There are few objects which are given the new home in Prism 5.0. If you are using any of the below mentioned objects, then you have to re-reference your assemblies with the new ones. Apart from assemblies, namespace is also changed. Please note, below mentioned changes are the breaking changes.

Object
New Location
DelegateCommand
CompositeCommand
PropertySupport
ErrorsContainer
Microsoft.Practices.Prism.MVVM
in
Microsoft.Practices.Prism.MVVM.dll
IActiveAware
Microsoft.Practices.Prism.SharedInterfaces.dll
CommandBehaviorBase
Microsoft.Practices.Prism.Interactivity
in
Microsoft.Practices.Prism.Interactivity.dll


Removed Objects
There are few objects in Prism 4.1, which are completely removed from Prism 5.0. This section discusses about the objects that are completely gone. This is again considered as a breaking change.

Object
Use
ButtonBaseClickCommandBehavior Click
Marked as obsolete in Prism 4.1
UriQuery
Microsoft.Practices.Prism.Regions.NavigationParameters
in
Microsoft.Practices.Prism.Composition.dll

Apart from all these changes, few changes are made to Quick Starts and help files also.

No comments:

Post a Comment