Prism & Silverlight: Part 1 - Taking Sketched Code Towards Unity

Download this episode

Download Video


This is part 1 of a series of screencasts illustrating some of the ideas found in "Prism" or the "Composite Application Guidance" from the Patterns and Practices team that can be used to build Silverlight applications in a way that lends itself to testability and modularity.

In talking to customers building business applications with Silverlight I find that Prism (and it's friend Unity) is frequently mentioned but not everyone has seen it and so I thought I would explore it myself and capture some of the results of that exploration here.

We start off with some fairly basic code which we move towards making use of dependency injection and modularity;

and then we move that code into the Silverlight world and try to illustrate some specific areas of Prism;

and then finally we try and bring some of these concepts together in a longer, more realistic example of a simple Email application built using the Prism framework - warning, this is a much longer session but I wanted something that draws things together;

The recommendation would be that you watch the 10 screencasts in order but if that feels like too long a process or if you're already very familiar with concepts like dependency injection and containers like Unity then perhaps watch the last screencast first and then refer back to the previous screencasts if certain areas need more illumination.

I put the source code for Video 10 here for download as it's a bigger set of source and something you might want to explore after the video - this does not necessarily represent "best practise" but is, instead, just meant to illustrate some of the Prism ideas.



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • Richard.Hein
      Thanks, that was good and the presenter is a very fast and flies through the code with impressively few typos ... I find it distracting when someone is typing live code and is constantly correcting typos through the presentation.  That makes it enjoyable to watch and follow along in VS, even if I had to "rewind" repeatedely while catching up.
    • rgruchalski

      Is the lack of audio planned? I mean, I don't mind but this looks somehow strange without audio?

    • Moshe

      Great video! Very nice to see good software design practices demonstrated in an easy-to-learn video. I was wondering what screen capture software you use to make these?

    • figuerres

      Interesting will have to view this later and see if it helps.


      from my view right now we have a rainstorm of bits coming out and no really clear directions.




      ADO Entitiy framwork


      linq to this that and the other....




      just to name the first few that come to mind


      and then add Azure (sp?)  and prism and unity


      Ah we need some UNITY in a really big way right now.....

      while beeing able to chose is mostly a good thing when you have so many and so little idea which ones to spend time with it's hard to

      get focus on any one thing.


      also after the way linq to SQL has been sidelined it now makes me ask what other cool stuff that's in the works today will be droped next year?  it's very very frustrating to try and pick the winner like it's a lotto when it's my time and money and my rep on the line.

    • Richard.Hein

      There should definitely be audio ... I haven't had any problems.

    • mtaulty



      I used Expression Encoder 3 Screen Capture - try it yourself from here - the standard version is free and will let you record up to 10 mins of screen capture.



    • mtaulty

      No, there's definitely meant to be audio - as a silent movie this is going to be a major flop Smiley

    • rgruchalski

      Yeah, just noticed, on the headphones earlier on I couldn't here the audio at all. Now I can hear it but it is really silent Smiley I found this to be an issue across c9 in general lately. Anyway, this looks like a great series, gonna have a late night tonight!

    • Deactivated User

      Comment removed at user's request.

    • Deactivated User

      Comment removed at user's request.

    • Kevin Nixon

      This is the good stuff.  I've previously used Prism in conjunction with Unity to create composite WPF clients in this manner, but it's useful to see a run through of the whole process (disclaimer .. I watched the first 40 minutes or so .. will continue with it tonight).  It's tackled at a refreshingly rapid pace whilst remaining clear and entirely comprehensible too.  Bravo.

    • Edsilv

      Gah! I keep getting MEDIA FAILURE errors as it loads Sad

    • mtaulty

      All wallpapers are from and cycled every so often via Windows 7 Smiley





    • Raumornie

      Wonderful videos Mike.  The 'live coding' style of presentation works far better for me than a cut and paste, pre-packaged format that seems to be all too common.  Keep up the good work!

    • mtaulty

      Thanks - will try Smiley

    • IanBlackburn

      Looks great Mike - many thanks - looking forward to watching these on my trip to Belfast this week.


      On a download point - for those trying the zune format download - none worked for me; the Zune player complained that all the files were corrupted (using the latest Zune software); download the wmv files instead which worked fine (but were bigger).

    • saschab

      Where do I get the lifetime back, I spent on this video ? ;o) I didn't expect a Webcast that has nothing at all to do with unity ...

    • mtaulty

      Ah, apologies if it wasn't useful to you. As I said "we start off with some fairly basic code which we move towards dependency injection and Unity". I didn't feel that just starting off and saying "Right, here's Unity" would necessarily work for everybody and so this video is really just the starting point for the code that we manipulate in the next three videos.


      As I say - one way to view these is to start with video 10 and then work back if and only if there's something that needs more explanation. The other way is to treat videos 1-9 as a set that make (hopefully) sense together.

    • Yazid

      How can I download it and watch it on the train or plane?




    • Aaron Hoffman

      The audio did not work in VLC for me, but did work in WMP 11 (fyi, I have the Expression 3 suite installed...)

    • Andy Kakembo

      Thanks for this Mike. It was the series that got me from reading about to using PRISM  & MVVM.


      The journey from monolithic to composite app matches a battle we've had at Pentagon and this has helped us loads in pulling all the technical strands together.


      A brilliant learning resource. Once again, thanks.

    • Joe Kahl

      Audio is there.  Definitely.

    • dianar77

      You are a great teacher, It is really a great series. I am right now in #6. and it has helped me a lot to understand prism. Thanks a lot.

    • v1r0n

      Please do update (or create new) videos with the latest Prism build.


      Thank you.


    • sirfmemon

      Hi Mike,

      can you pplease provide complete set of code from begining till end. I liked your way of explaining the modular apporach.



    • GautamG


      This is the best explanation that I could find to learn about Prism and Unity. Thank you for all your effort and the great tutorials you have posted. 

    • mrooney

      Wow!  What a wonderful, concise and very fluid setup...  Not understanding why I would want to use Unity at the beginning of this video, I'm now seeing it's value!  Great Job!  Very Professional.  Wish you were my prof in university!

    • Stephen McMahon

      Winston Pang mentioned that all of the iPod versions were the same.  Actually, they are all different, but when imported the MP4 files into iTunes they all have the same title which makes it difficult to determine the order in which to watch them.  I compared the times from the web versions and changed the titles accordingly and then re-synced to my iPad.
      That aside, I believe that these are excellent sessions.  I really appreciate that these start at a very basic level and slowly bring the user into the actual goal of the presentation.  I have already recommended this to my co-workers.

    • Santosh

      Hi Mike,

      Really Great explanation!! I was trying my implementation in the same way, but there is some problem while configure the container from App.config file, there is "The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)" error shown at run time. However the references are accurate. Can you please explain more about the unity container app.config file?

      Santosh Dubey

    • Nikunj

      I am not able to load video since 30 minutes, can anybody tell me what is the issue?


    • SchalkvanWyk
      Hi Mike Great effort, but please inform the more advanced guys in ADVANCE to start watching the videos from the bottom up. The first video gives a good background, but man it's not something I need to go through... (would have been great about 5 years back). I will download part 10, hopefully it will be more useful...
    • Boris

      Mike, thank you so much for these videos - they've been immensely helpful to me so far. However, I am facing a problem with your sample and I was wondering if you could share your thoughts with me on that:

      At the end of your 3rd video "Modularity with Prism", the code should be divided into modules and the Program.cs should run them with the manager. I am fairly sure that my code matches yours, but upon debugging the app, the loading of the first module CalculatorCommandParsingModule throws an exception with the message:
      "An exception occurred while initializing module 'Parsing'.
      - The exception message was: Could not load file or assembly 'Interfaces, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
      Now, interfaces is referenced from the CalculatorCommandParsing library and everything build with no error.

      Any ideas?
      Thank you very very much.

    • Manish

      Amazing presentation and structuring... Great Job altogether...

    • Jignesh Gandhi


      Fantastic videos. I really learnt a lot more faster with the live code presentation.

      Thanks a ton!!!!


    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.