Silverlight Reporting Application Part 3.5 - Prism Background and WCF RIA [Series Intermission]

Friday, March 12, 2010 by Evan Hutnick | Comments 10

Taking a step back before I dive into the details and full-on coding fun, I wanted to once again respond to a comment on my last post to clear up some things in regards to how I'm setting up my project and some of the choices I've made.  Aka, thanks Ben. :)

Prism Project Setup

For starters, I'm not the ideal use case for a Prism application.  In most cases where you've got a one-man team, Prism can be overkill as it is more intended for large teams who are geographically dispersed or in applications that have a larger scale than my Recruiting application in which you'll greatly benefit from modularity, delayed loading of xaps, etc.  What Prism offers, though, is a manner for handling UI, commands, and events with the idea that, through a modular approach in which no parts really need to know about one another, I can update this application bit by bit as hiring needs change or requirements differ between offices without having to worry that changing something in the Jobs module will break something in, say, the Scheduling module. 

All that being said, here's a look at how our project breakdown for Recruit (MVVM/Prism implementation) looks:

Application Layout

This could be a little misleading though, as each of those modules is actually another project in the overall Recruit solution.  As far as what the projects actually are, that looks a bit like this:

  • Recruiting Solution
    • Recruit (Shell up there) - Main Silverlight Application
    • .Web - Default .Web application to host the Silverlight app
    • Infrastructure - Silverlight Class Library Project
    • Modules - Silverlight Class Library Projects

Infrastructure & Modules

The Infrastructure project is probably something you'll see to some degree in any composite application.  In this application, it is going to contain custom commands (you'll see the joy of these in a post or two down the road), events, helper classes, and any custom classes I need to share between different modules.  Think of this as a handy little crossroad between any parts of your application. 

Modules on the other hand are the bread and butter of this application.  Besides the shell, which holds the UI skeleton, and the infrastructure, which holds all those shared goodies, the modules are self-contained bundles of functionality to handle different concerns.  In my scenario, I need a way to look up and edit Jobs, Applicants, and Schedule interviews, a Notification module to handle telling the user when different things are happening (i.e., loading from database), and a Menu to control interaction and moving between different views.  All modules are going to follow the following pattern:

Module Layout

The module class will inherit from IModule and handle initialization and loading the correct view into the correct region, whereas the Views and ViewModels folders will contain paired Silverlight user controls and ViewModel class backings. 

WCF RIA Services

Since we've got all the projects in a single solution, we did not have to go the route of creating a WCR RIA Services Class Library.  Every module has it's WCF RIA link back to the main .Web project, so the single Linq-2-SQL (yes, I said Linq-2-SQL, but I'll soon be switching to OpenAccess due to the new visual designer) context I'm using there works nicely with the scope of my project.  If I were going for completely separating this project out and doing different, dynamically loaded elements, I'd probably go for the separate class library.  Hope that clears that up.  In the future though, I will be using that in a project that I've got in the "when I've got enough time to work on this" pipeline, so we'll get into that eventually- and hopefully when WCF RIA is in full release!

Why Not use Silverlight Navigation/Business Template?

The short answer- I'm a creature of habit, and having used Silverlight for a few years now, I'm used to doing lots of things manually. :)  Plus, starting with a blank slate of a project I'm able to set up things exactly as I want them to be.  In this case, rather than the navigation frame we would see in one of the templates, the MainRegion/ContentControl is working as our main navigation window.  In many cases I will use the Silverlight navigation template to start things off, however in this case I did not need those features so I opted out of using that.

Next time when I actually hit post #4, we're going to get into the modules and starting to get functionality into this application.  Next week is also release week for the Q1 2010 release, so be sure to check out our annual Webinar Week (I might be biased, but Wednesday is my favorite out of the group).

10 Comments

  • Ricardo Pinto. 12 Mar 2010
    Hi Evan!

    "Silverlight Reporting Application Part 3.5"
    I suppose you meant to say "Silverlight Recruiting Application Part 3.5" ;)

    Great series by the way!!!
    I'm new to Prism and even Silverlight but I think it's really worth to follow and learn :)

    Regards!
  • Evan Hutnick 12 Mar 2010
    Hey Ricardo,

    You hit the nail on the head on that one. :)  I'm working on two applications right now internally, one which is reporting and the other is recruiting, so my brain didn't catch on to the title until it was too late. 

    And thank you!  Currently working on the next piece and trying to beat a meeting deadline later this afternoon to get it published (and with a correct title!).

    -Evan
  • Charlie J. Biggs 12 Mar 2010
    Hey Evan, 

    When will the new Silverlight 4 Dlls be available?  You mention in your Webinar I attended for Silverlight and WPF Q1 2010 that they would be up by the end of this week.  Any updates?

    Thanks,

    Charlie J.
  • Ben Hayat 12 Mar 2010
    Charlie, although he did mention this Friday, but then he did emphasized more that it might be next week after MIX. We might be getting newer version of SL4 at MIX, and Telerik wants to make sure if we do, they would cover the new version and not the current beta.

    Hope this helps!
    ..Ben
  • Charlie J. Biggs 12 Mar 2010
    Thanks Ben.  I fully understand.   I know everyone is waiting for Silverlight RC and Silverlight RTM.  I notice on your latest Internal Build for Silverlight.   There are 2 versions.  Is one for Silverlight 3 and the other one is for Silverlight 4?

    Thanks,

    Charlie J.
  • Evan Hutnick 12 Mar 2010
    Hey Charlie,

    We did put out a SL4 latest internal build today, but Ben is right that you might want to wait until next week for something a little sweeter.  You know Microsoft and their conferences, always have some kind of surprise planned!

    -Evan
  • Ben Hayat 12 Mar 2010
    I need to check with the team on the SL4 built before I can answer you. Personally, I'll wait for MIX announcement and see if there is anything new, then I'll ask Telerik team to verify the SL4 built. I've made the mistake in the past by rushing and I paid the price. I'm going to seat back till the water levels itself out :-)

    BTW, you were able to look at my account and see what's available in my account for download?
    ..Ben
  • Charlie J. Biggs 12 Mar 2010
    Thanks Evan and Ben,

    I know so well the pain of acting early on something Microsoft puts out.  I see the SL4 in the internal build under my account but no under the Silverlight Q1 2010 link where it suppose to list the SL 4 dlls.  We can and will wait after MIX to see what Microsoft have in store for all of us.

    Thanks,

    Charlie J.
  • Ben Hayat 14 Mar 2010
    Evan, have you also considered at some point to introduce MEF into this project? I think it will wrap up the "Plugin" modularity pretty nicely.
    ..Ben
  • Evan Hutnick 17 Mar 2010
    Ben - That'll be in V2 of the app, waiting until all the .Net 4/SL4 stuff goes official before working on an updated, more streamlined version. :)

    Charlie- RC builds are now available in accounts, check 'em out and let us know what you think.  I can breath easy and finally install the VS2010 RC on my machine. :)
  1. Formatting options
       
     
     
     
     
       
  2. (optional, emails won't be shown on public pages)
  3. (optional)