<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Erwin van der Valk's blog: Practicing patterns : patterns &amp;amp; practices</title><link>http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx</link><description>Tags: patterns &amp;amp; practices</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Announcing the guide for claims based identity and access control</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/10/02/announcing-the-guide-for-claims-based-identity-and-access-control.aspx</link><pubDate>Sat, 03 Oct 2009 01:37:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9902614</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9902614.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9902614</wfw:commentRss><description>&lt;p&gt;Today, we’ve put the first beta drop of the book ‘Guide for Claims based identity and access control’ online. You can find the beta of the guide at &lt;a title="Claims guide on codeplex" href="http://claimsid.codeplex.com/Wiki/View.aspx?title=Home" target="_blank"&gt;Codeplex&lt;/a&gt;. Over the next couple of weeks, we’ll keep placing new releases online, so keep looking. &lt;/p&gt;  &lt;p&gt;So what are these ‘Claims’ and why create a whole guide about them? Simple, it will help you overcome the current &lt;a title="Password hell&amp;#39;s everywhere" href="http://www.bing.com/search?q=password+hell&amp;amp;form=QBLH&amp;amp;qs=n" target="_blank"&gt;password hell&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h1&gt;Password Hell&lt;/h1&gt;  &lt;p&gt;It’s true.. almost website you go to wants to know who visits their site. &lt;/p&gt;  &lt;p&gt;This is not just a problem for regular internet users, but it’s a massive problem for organizations. A typical organization will have a lot of applications, both internal for it’s own employees and external for customers. Now of course, there are authentication solutions for each scenario: Windows integrated authentication, Forms based authentication, smart cards, and many more solutions. Each with it’s particular advantages and disadvantages. &lt;/p&gt;  &lt;p&gt;With each solution, you get an island of identities. An active directory here, a database with users there. Then a couple more when the organization merges or starts to cooperate with other organizations. And each user store has to be managed when new users are introduced, roles change or when people leave the organization. With typically many identity stores in an organization, this can easily become a management nightmare. &lt;/p&gt;  &lt;h1&gt;Claims based identity and access control&lt;/h1&gt;  &lt;p&gt;The goal of claims based identity and access control is, to abstract the authentication logic from applications and and let somebody we trust handle that. We do it all the time. &lt;/p&gt;  &lt;p&gt;A passport is a typical ‘real world’ example of a claim. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Passports without claims&lt;/h2&gt;  &lt;p&gt;For some countries, you need a visa to enter. That means going to the embassy and request a visa to enter that country. If you can provide sufficient reason to want to enter that country, you’ll receive your visa within several weeks. If you loose your visa, you can replace it. It will just take you several weeks again. &lt;/p&gt;  &lt;p&gt;Sound familiar? That’s how a typical website works nowadays. You can sign up and get a password. Sometimes you can get a password automatically, but sometimes it has to be created manually. And if you loose it, you’ll have to request a new one. &lt;/p&gt;  &lt;h2&gt;Passport as a claim&lt;/h2&gt;  &lt;p&gt;Fortunately, to most countries, you can travel without a visa. That’s because those countries trust each other to a certain degree. If you come with a certified valid document (your passport), and the country you are trying to enter trusts your country, then they will typically let you in. And since the passports are protected with all kinds of forgery protection tricks, it’s very hard to create a fake passport. &lt;/p&gt;  &lt;p&gt;This looks like claims bases authentication. A trusted party can issue claims (a passport) and your application can decide if you trust claims from that trusted party or not. Because the claims are digitally signed, it’s nearly impossible to tamper with them. One example of this is single sign-on, such as with OpenID or a Live-ID. &lt;/p&gt;  &lt;h2&gt;Claims based authentication&lt;/h2&gt;  &lt;p&gt;Claims based authentication is not new. It’s been around for many years. But with the introduction of open standards and Microsoft technologies like &lt;a title="Geneva on Microsoft.com" href="http://www.microsoft.com/forefront/geneva/en/us/" target="_blank"&gt;Geneva&lt;/a&gt; it becomes a lot easier to implement. &lt;/p&gt;  &lt;h1&gt;Goal of the guide&lt;/h1&gt;  &lt;p&gt;Authentication touches a lot of people within your organization. Architects, developers, IT-pros, security experts. Each contribute a piece to the whole authentication story. The goal of the guide is, to make claims based authentication and access control understandable for everybody. &lt;/p&gt;  &lt;p&gt;So how are we doing that? A clear, scenario based approach with lot’s of samples. &lt;/p&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h2&gt;Yes, now YOU can also take advantage of claims based authentication&lt;/h2&gt;  &lt;p&gt;As always, we’re open to feedback. Let us know what you think and make a difference!    &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9902614" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Claimz/default.aspx">Claimz</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WIF/default.aspx">WIF</category></item><item><title>writing applications that target both wpf and silverlight with a single codebase</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/09/03/writing-applications-that-target-both-wpf-and-silverlight-with-a-single-codebase.aspx</link><pubDate>Thu, 03 Sep 2009 23:09:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9891066</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9891066.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9891066</wfw:commentRss><description>&lt;p&gt;A while back, I wrote an MSDN article on writing multi-targeted programs with Prism.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/magazine/ee321573.aspx" href="http://msdn.microsoft.com/en-us/magazine/ee321573.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/ee321573.aspx&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hope you like it!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9891066" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Prism/default.aspx">Prism</category></item><item><title>Sharepoint guidance v2 – drop 9</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/05/13/sharepoint-guidance-v2-drop-9.aspx</link><pubDate>Wed, 13 May 2009 19:16:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9609532</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9609532.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9609532</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;This week, we published the results of interation 9 to our codeplex site. &lt;/p&gt;  &lt;p&gt;You can get it here:&lt;/p&gt;  &lt;p&gt;&lt;a title="SPG Drop 9" href="http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27299" target="_blank"&gt;http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27299&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this drop, we have addressed a number of tasks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Implemented trusted facade pattern and removed the fake SSO provider &lt;/li&gt;    &lt;li&gt;Refactored the repositories to make better use of WCF Proxies &lt;/li&gt;    &lt;li&gt;Support for UpdatePanel in SafeScriptManager &lt;/li&gt;    &lt;li&gt;Updated PartnerLandingPage &lt;/li&gt;    &lt;li&gt;Removed most usages of .net 3.5 &lt;/li&gt;    &lt;li&gt;Provided instructions on how to use a host name to access extranet site &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Trusted facade pattern&lt;/h1&gt;  &lt;p&gt;We are demonstrating in our RI how to call back-end services from SharePoint. It’s quite common to have different credentials to log on to back end services. &lt;/p&gt;  &lt;h2&gt;Replacing the fake SSO provider&lt;/h2&gt;  &lt;p&gt;Before, we were using a fake SSO provider (Single Sign On) for that. We built a fake SSO provider because it’s actually quite hard and complex to build a real SSO provider. Since the SSO provider should store passwords in a secure way, there are a whole range of attacks you need to watch for. We felt we didn’t want to take on that extra complexity in our project, so we built a fake SSO provider that stored the passwords in clear text. We hoped that calling it ‘fake’ would make it clear enough that this is not something you would want to do in production. &lt;/p&gt;  &lt;p&gt;We a lot of feedback that giving an example that shows how to store passwords in clear text is bad. No matter how clearly you explain that it’s not something you want to do in production, somebody is going to do it anyway. But since didn’t want to show you how to build a real SSO provider (that would be a project in itself), we decided to change our implementation to a trusted facade.&amp;#160; &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Trusted facade explained&lt;/h2&gt;  &lt;p&gt;The following diagram shows the trusted facade pattern:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_thumb_1.png" width="534" height="278" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A user authenticates with the trusted facade. It validates the credentials provided by the user. Then, if the trusted facade calls the back end service on behalf of the user, it only specifies the username. The back end service trusts the Trusted Facade to provide the correct username, so it doesn’t need to perform any authentication. &lt;/p&gt;  &lt;p&gt;We implemented our trusted facade based on this &lt;a title="MSDN Article that describes how to implement the trusted facade." href="http://msdn.microsoft.com/en-us/library/aa355058.aspx" target="_blank"&gt;MSDN article&lt;/a&gt;. Our implementation looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_thumb_2.png" width="765" height="464" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A user connects to SharePoint either through windows authentication or through Forms Based Authentication (FBA). Then, when the user wants to make a request to a backend system, for example to retrieve the price for a product, the pricing repository will find out what partner the user belongs to. It will then call the back end service with the name of the partner. The pricing service trusts our SharePoint application to provide the correct partner name, so it doesn’t require any passwords.&amp;#160; &lt;/p&gt;  &lt;p&gt;Of course, you have to make sure that only the account that SharePoint runs under is allowed to access the pricing service. &lt;/p&gt;  &lt;h1&gt;Repository refactoring&lt;/h1&gt;  &lt;p&gt;We took a critical look at our current implementation of the repositories. &lt;/p&gt;  &lt;p&gt;The goal of the repositories is to hide data access logic from consumers. For example, we have a ProductCatalogRepository, which has methods like: GetProduct(string sku) to retrieve product information. This repository uses the BDC for some of it’s methods, but for other, it calls into our productcatalog webservices directly. However, the consumers of these repositories don’t know where the data comes from. They also don’t know (and don’t care) that the data is cached. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Webservice proxies&lt;/h2&gt;  &lt;p&gt;Adding a reference to a webservice is very simple in Visual Studio. What happens under the covers is quite a bit more complex. Visual studio will generate proxy classes based on the metadata that’s returned from the service. &lt;/p&gt;  &lt;p&gt;We implemented the following best practices for calling web services:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;If your service references are used by multiple projects, create a single project that holds the service references and reference that project.        &lt;br /&gt;&lt;/strong&gt;There are to reasons for this. If you are making changes to your webservice, you only have to update one service reference. Forgetting to update one can cause annoying bugs. But from a design perspective, if you generate two proxies for the same web service, then you’ll have duplicate (incompatible) types in your system. For example, the price object generated for proxy 1 will be different from the price object generated for proxy 2. Even though they have exactly the same signature, you can’t reuse the types for them or reuse methods that work on them. We implemented this in the Contoso.Pss.Services.Client solution.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Don’t call the service proxies directly, but wrap the calls to the service proxies into repositories or service agents.        &lt;br /&gt;&lt;/strong&gt;This best practice is used to shield your application from (minor) changes to the service. It does take some extra coding, because you have to transform the objects you get back from the service into objects that can be used by your application. So this practice does adds a level of indirection and extra complexity to your application, so you have to make the tradeoff if the extra complexity is worth the isolation. In general, if the services are created for and only used by your application, you typically don’t need such a level of indirection. However, if you don’t have control over your services or other clients are also using the services, it’s often worth it. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;There were a couple of area’s we explicitly didn’t look at. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Getting the repositories from the service locator&lt;/h2&gt;  &lt;p&gt;Before, we were creating the repositories directly in our code, for example in our presenters. This is often undesirable, because it makes the presenters harder to unit test. Now, we have registered the repositories in our service locator. Therefore, we can use the service locator to get instances of our repositories and we are able to mock out these in our unit tests. Sweet :)&lt;/p&gt;  &lt;h1&gt;UpdatePanel in sharepoint&lt;/h1&gt;  &lt;p&gt;SharePoint has a slightly different method for implementing post backs than the normal ASP.Net framework. It uses a custom javascript method that is called on postback. Unfortunately, this means that the Ajax UpdatePanel doesn’t work out of the box, because it also requires a different postback method. The solution is to emit some JavaScript code that intercepts the postback event and calls the normal UpdatePanel posback code. &lt;/p&gt;  &lt;p&gt;In order to get the UpdatePanel to work, you need a scriptmanager, because that will add the required javascript code for the async postback to the page. We had already built a SafeScriptManager, that you can add several times to a page without causing issues. So it was natural to add some functionality to it to enable support for the UpdatePanel. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Removed most .net 3.5 usages&lt;/h1&gt;  &lt;p&gt;We were making judicious use of the wonderful new features of .Net 3.5 such as Linq queries, lambda expressions and type initializers. However, we got the feedback from our advisors that .net 3.5 is not widely used by the sharepoint developer community. After many discussions, we agreed that removing most of the .net 3.5 usages would make our guidance a bit more consumable by the sharepoint developer community. &lt;/p&gt;  &lt;h1&gt;Added instructions on how to use a host name to access extranet site&lt;/h1&gt;  &lt;p&gt;Lastly, we added some instructions on how to use a host name to access extranet sites. Now, our extranet site is accessable on localhost:9001. If you would prefer to host the extranet site on a hostname, for example extranet.mydomain.com, we have included instructions on how to do that. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9609532" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item><item><title>sharepoint guidance drop 8 video online</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/04/30/sharepoint-guidance-drop-8-video-online.aspx</link><pubDate>Thu, 30 Apr 2009 20:08:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9580789</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9580789.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9580789</wfw:commentRss><description>&lt;p&gt;Hi guys,&lt;/p&gt;  &lt;p&gt;Our drop 8 video is online on Channel 9. Check it out:&lt;/p&gt; &lt;iframe height="325" src="http://channel9.msdn.com/posts/akmsft/467414/player/" frameborder="0" width="320" scrolling="no" mce_src="http://channel9.msdn.com/posts/akmsft/467414//player/"&gt;&lt;/iframe&gt;  &lt;p&gt;Happy watching and keep practicing!&lt;/p&gt;  &lt;p&gt;_Erwin&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9580789" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item><item><title>what do you think of prism?</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/04/01/what-do-you-think-of-prism.aspx</link><pubDate>Wed, 01 Apr 2009 20:40:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9527405</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9527405.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9527405</wfw:commentRss><description>&lt;p&gt;Prism has been out for quite a while now. I hope you had some time to play with it, read the docs, look at the code and build apps with it. So, what do &lt;strong&gt;&lt;u&gt;YOU&lt;/u&gt;&lt;/strong&gt; think of prism? Did you like it? Did it help solve your composite application problems? Was it easy to use or very hard? Please let us know by filling out this survey:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.zoomerang.com/Survey/survey-intro.zgi?p=WEB228YSYYRK4A" href="http://www.zoomerang.com/Survey/survey-intro.zgi?p=WEB228YSYYRK4A"&gt;http://www.zoomerang.com/Survey/survey-intro.zgi?p=WEB228YSYYRK4A&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Of course, you don’t have to.. but this is your chance. If you really liked prism, then tell us. That way, we know we have to invest more in future versions of Prism ;)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9527405" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/CAL/default.aspx">CAL</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Prism/default.aspx">Prism</category></item><item><title>p&amp;p Sharepoint guidance v2</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/03/20/p-p-sharepoint-guidance-v2.aspx</link><pubDate>Fri, 20 Mar 2009 06:30:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9491688</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9491688.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9491688</wfw:commentRss><description>&lt;p&gt;Since the Prism project is done, I’ll be working on a different project for the next couple of months. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeplex.com/spg" target="_blank"&gt;Sharepoint guidance on Codeplex&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The goal of this project is to provide guidance on how to build Sharepoint applications in a professional way. &lt;/p&gt;  &lt;h1&gt;Version 1 of Sharepoint Guidance&lt;/h1&gt;  &lt;p&gt;V1 of the Sharepoint guidance project focused mainly around the following aspects:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How to work with development, testing and production environments. &lt;/li&gt;    &lt;li&gt;How to build sharepoint solutions in a Test Driven fashion. &lt;/li&gt;    &lt;li&gt;How to set up a Continious Integration environment, that does our Builds, and runs our Unit and Acceptance Tests &lt;/li&gt;    &lt;li&gt;How to build Sharepoint applications that can be versioned. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To do this, we’ve built a reference implementation that demonstrates all of these concepts. &lt;/p&gt;  &lt;h1&gt;Version 2 of Sharepoint Guidance&lt;/h1&gt;  &lt;p&gt;We are now well on our way with the Sharepoint Guidance and are already in iteration 6 (we have two week interations). &lt;/p&gt;  &lt;p&gt;In V2, we have the following goals:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How to design and build content driven applications      &lt;ul&gt;       &lt;li&gt;How to develop an application that allows a mixture of development activities and authoring. &lt;/li&gt;        &lt;li&gt;How to create composite &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;How to extend existing LOB systems:      &lt;ul&gt;       &lt;li&gt;How to integrate LOB systems in a secure way using Single Sign-On (SSO) &lt;/li&gt;        &lt;li&gt;How to manage connectivity with LOB systems and databases by using the Business Data Catalog (BDC) and call Windows Communication Foundation (WCF) from Sharepoint.&amp;#160; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Sharepoint Guidance V2 – Drop 5&lt;/h1&gt;  &lt;p&gt;Last Friday, we’ve released drop 5 to codeplex. You can download it from here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24674" href="http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24674"&gt;http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24674&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The most important things we have addressed in this drop are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How to implement global navigation, across different site collections.&amp;#160; &lt;/li&gt;    &lt;li&gt;How to implement custom navigation. &lt;/li&gt;    &lt;li&gt;How to add Silverlight controls to your site. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/francischeung/" target="_blank"&gt;Francis cheung&lt;/a&gt; and I have created a webcast that guides you trough some of the things we did in drop 5:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:4e5e7126-f6e6-48c8-bf0a-f150632624fa" class="wlWriterEditableSmartContent"&gt;&lt;div id="8b7f6255-b9e3-4759-93cc-65fd089edc81" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://video.msn.com/video.aspx?vid=207890eb-f382-42bc-99cb-a3533435631c&amp;amp;from=writer" target="_new"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/video1850d7bd2463.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('8b7f6255-b9e3-4759-93cc-65fd089edc81'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;embed src=\&amp;quot;http://images.video.msn.com/flash/soapbox1_1.swf\&amp;quot; quality=\&amp;quot;high\&amp;quot; width=\&amp;quot;623\&amp;quot; height=\&amp;quot;524\&amp;quot; wmode=\&amp;quot;transparent\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; pluginspage=\&amp;quot;http://macromedia.com/go/getflashplayer\&amp;quot; flashvars=\&amp;quot;c=v&amp;amp;v=207890eb-f382-42bc-99cb-a3533435631c&amp;amp;from=writer&amp;amp;mkt=en-US\&amp;quot; &amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Global navigation&lt;/h1&gt;  &lt;p&gt;In our reference implementation, we’re demonstrating how to create consistent navigation across different sites and site collections. It’s very simple to create a sitemap for a single site, by creating a sitemap.xml and using the asp.net sitemap control to create the sitemap and add it to your site. However, creating a sitemap that’s shared between all sites is a bit harder.&lt;/p&gt;  &lt;p&gt;The structure of our reference implementation is as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_thumb.png" width="532" height="332" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We have a sitecollection for our intranet site, a sitecollection for our extranet site and a sitecollection for partner specific sites. Partners who log on to their homepage, will likely navigate between pages on their site and pages on the extranet home, for example to view products or promotions. &lt;/p&gt;  &lt;p&gt;We want the global navigation structure to look somewhat like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_thumb_1.png" width="495" height="274" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The partner should be able to seamlessly navigate between each part of our Sharepoint site. Of course, we only want to have the structure of our site stored and versioned in one place. So to create a consistent story across multiple pages, we have taken the following steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Created a Sharepoint deployment project to create a feature that will apply a masterpage (with the website’s branding). This masterpage also contains a sitemap control that points to the SPXmlContentMapProvider:      &lt;br /&gt;      &lt;div&gt;       &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:SiteMapDataSource&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ShowStartingNode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; 
    &lt;span style="color: #ff0000"&gt;StartingNodeUrl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/pssportalroot&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;SiteMapProvider&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;SPXmlContentMapProvider&amp;quot;&lt;/span&gt; 
    &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;contosoPssSiteMap&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Create a Sitemap xml file that will be placed 12 hyve. To do that, you have to put it in the folder Templates\Layouts folder. 
    &lt;br /&gt;

    &lt;br /&gt;The sitemap xml looks like this: 

    &lt;br /&gt;

    &lt;div&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMap&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/pssportalroot&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Partner Home&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/_layouts/contoso/partnerredirect.aspx?page=Home&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Manage Incidents&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/_layouts/contoso/partnerredirect.aspx?page=incidents&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Product Catalog&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/sites/pssportal/productcatalog/category.aspx?categoryid=0&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Promotions&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/sites/pssportal/promotions&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Search&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/sites/pssportal/search&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMap&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Create a featurereceiver to merge the sitemap xml fragment into sharepoints global sitemap. To do that, call the following method in the FeatureActivated method of the FeatureReceiver: 
    &lt;br /&gt;

    &lt;br /&gt;

    &lt;div&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;web.Site.WebApplication.Farm.Services.GetValue&amp;lt;SPWebService&amp;gt;()
    .ApplyApplicationContentToLocalServer();&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Custom sitemapprovider&lt;/h1&gt;

&lt;p&gt;We are also demonstrating how fill a sitemappath control with custom data and we are using the business data catalog for that. &lt;/p&gt;

&lt;p&gt;In our scenario, the business data catalog provides a list of categories and products (which it gets from WCF webservices in a different system). It then uses this data to create category and product pages to display the individual catalogs and products. &lt;/p&gt;

&lt;p&gt;We’ve created a custom sitemap provider that will retrieve the categories and url’s to the category pages from the BDC. We then tie a normal asp.net sitemappath control to that sitemap provider to display a ‘crumb’ path&amp;#160; that displays sitemap information. &lt;/p&gt;

&lt;h1&gt;Silverlight Controls&lt;/h1&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;In our reference implementation, we are also demonstrating how to add silverlight controls to your site. To a ‘normal’ asp.net webapplication, adding silverlight controls is really easy, because the IDE takes a lot of things out of your hands. In Sharepoint, unfortunately that’s not as easy. So if you want to use the Serverside Silverlight controls (in System.Web.Silverlight, from the Silverlight SDK), you will also need to have Asp.net Ajax support in your site. This means: Adding the required entries to the web.config and adding a scriptmanager control to your page. &lt;/p&gt;

&lt;h2&gt;Web.config changes&lt;/h2&gt;

&lt;p&gt;There are basically two ways to make changes to the web.config of a sharepoint server. Programmatically, through the API or declaratively, in a XML file. Since there are quite a few changes you have to make to your web.config, we figured the declarative approach works best. Again, you have to call ApplyApplicationContentToLocalServer() to merge the declarative changes into the web.config. I’ll write a later blogpost or do a webcast on how to do this in more detail.&amp;#160; But if you are interested, you can always look at our drop.&lt;/p&gt;

&lt;h2&gt;SafeScriptManager&lt;/h2&gt;

&lt;p&gt;The scriptmanager proved to be an issue. You can only have 1 scriptmanager on your page and it must appear before any controls that need it. Normally, you would add a scriptmanager to your masterpage and be done with it. However, sharepoint is quite dynamic with it’s masterpages. You can easily create a new masterpage and use it as the default masterpage for some group of pages. So this means that if you use ajax in some of your webparts, you can no longer use those webparts on pages that don’t have a scriptmanager. &lt;/p&gt;

&lt;p&gt;So we’ve created a control called the SafeScriptManager. You can safely add it to any controls or webpart that needs a scriptmanager. It will check if a scriptmanager is already present. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;I hope this clarifies a bit what we have done in this drop. I plan on doing a blog post and a webcast for each drop from now on. As always, any feedback (on the post, on the drop or on the weather) are welcome :)&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9491688" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item><item><title>Test if classes are registered in unity</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/02/13/test-if-classes-are-registered-in-unity.aspx</link><pubDate>Sat, 14 Feb 2009 01:45:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9420210</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9420210.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9420210</wfw:commentRss><description>&lt;p&gt;While writing some sample applications for the upcoming release of Prism (Composite Application Guidance for WPF and Silverlight) I ran into a small challenge. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“How do you verify (with unit tests) that the right classes are registered in your DI-container?”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In my case, the container is Unity, but Unity does not have any ‘IsTypeRegistered’ methods (Apparently there are good reasons for it not to have these methods). So that posses an interesting challenge. At first I thought of 2 solutions:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Manually create a mock of your container.        &lt;br /&gt;&lt;/strong&gt;Certainly possible but a lot of work for my small demo app. A mocking framework can help with this, but i don’t want to rely on a mocking framework for a small demo app.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;See if the components are registered by resolving the type.        &lt;br /&gt;&lt;/strong&gt;This will work initially, but it will actually instantiate the object. So if the object can’t be created for some reason, your test will fail. Now if the type you have just registered has a lot of dependencies, you will need to satisfy all those dependencies in the container before you can even begin to create the object. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;But neither of these options were really satisfying. Then I asked Chris Tavarez, and he mentioned: Why don’t you build a Unity Extension. So I did and that solved the problem quite nicely:&lt;/p&gt;  &lt;p&gt;So this is the Extension I’ve created:&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; QueryableContainerExtension : UnityContainerExtension&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; List&amp;lt;RegisterEventArgs&amp;gt; Registrations = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;RegisterEventArgs&amp;gt;();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Initialize()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Context.Registering += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;RegisterEventArgs&amp;gt;(Context_Registering);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Context_Registering(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, RegisterEventArgs e)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Registrations.Add(e);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; IsTypeRegistered&amp;lt;TFrom, TTo&amp;gt;()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Registrations.FirstOrDefault((e) =&amp;gt; e.TypeFrom == &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(TFrom) &amp;amp;&amp;amp; e.TypeTo == &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(TTo)) != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; IsTypeRegisteredAsSingleton&amp;lt;TFrom, TTo&amp;gt;()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Registrations.FirstOrDefault(&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;             (e) =&amp;gt; e.TypeFrom == &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(TFrom)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;                 &amp;amp;&amp;amp; e.TypeTo == &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(TTo)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;                 &amp;amp;&amp;amp; &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ContainerControlledLifetimeManager).IsInstanceOfType(e.LifetimeManager)) != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And this is how you’d use it:&lt;/p&gt;

&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; height: 301px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; [TestMethod]&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; TestRegistration()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Create the container and add the extension method&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     var container = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; UnityContainer();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     var registeredTypes = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; QueryableContainerExtension();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     container.AddExtension(registeredTypes);&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// Register the classes to the container&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     container.Register&amp;lt;IMyInterface, MyClass&amp;gt;();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #008000"&gt;// See if the type is registered&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     Assert.IsTrue(registeredTypes.IsTypeRegistered&amp;lt;IMyInterface, MyClass&amp;gt;());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Hope you find this as useful as I did :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9420210" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Prism/default.aspx">Prism</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Unit+Testing/default.aspx">Unit Testing</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Unity/default.aspx">Unity</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Dependency+Injection/default.aspx">Dependency Injection</category></item><item><title>prism v2 – drop 10 (composite application guidance)</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/01/30/prism-v2-drop-10-composite-application-guidance.aspx</link><pubDate>Sat, 31 Jan 2009 02:41:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9385502</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9385502.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9385502</wfw:commentRss><description>&lt;p&gt;Today, we have released what’s likely going to be the last drop of Prism before the final release. You can get the release from:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=22566" href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=22566"&gt;http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=22566&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;During this iteration, we have mostly worked on documentation, implementing a new UI for the Stock Trader Reference Implementation and fixing some last important bugs. &lt;/p&gt;  &lt;p&gt;The most important changes are:&lt;/p&gt;  &lt;li&gt;Removed .Silverlight and .Desktop extensions from the Assembly names, both in the Library and in all the Quickstarts. &lt;/li&gt;  &lt;li&gt;Renamed RegionExtensions class to RegionContext and RegionExtensions.GetRegionContext() method to RegionContext.GetObservableContext() &lt;/li&gt;  &lt;li&gt;Moved RegionExtensions.GetObservableRegion() method from RegionExtensions class to RegionManager class. &lt;/li&gt;  &lt;li&gt;Integrated new UI design for Stock Trader Reference Implementation. &lt;/li&gt;  &lt;li&gt;Many updates to Documentation &lt;/li&gt;  &lt;li&gt;Included API CHM file &lt;/li&gt;  &lt;li&gt;Added shortcut .Bat files to make it easier to open the solutions. &lt;/li&gt;  &lt;li&gt;Bug fixes &lt;/li&gt;  &lt;li&gt;Added missing XML comments to the code of the Composite Application Library.&lt;/li&gt;  &lt;h1&gt;&amp;#160;&lt;/h1&gt;  &lt;h1&gt;New UI for Stock Trader Reference Implementation&lt;/h1&gt;  &lt;p&gt;We felt that the original UI of the Stocktrader RI didn’t give a good impression of the capabilities of WPF and Silverlight. Most of the things we were showing before were also possible with Windows Forms. So for this release, we’ve decided to hire a graphical design company to give our RI a complete makeover, complete with some cool animations. &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="200"&gt;&lt;strong&gt;Before:&lt;/strong&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/prismv2drop10compositeapplicationguidanc_DCB4/image_2.png"&gt;           &lt;br /&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/prismv2drop10compositeapplicationguidanc_DCB4/image_thumb.png" width="463" height="313" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="200"&gt;After:&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/prismv2drop10compositeapplicationguidanc_DCB4/image_6.png"&gt;           &lt;br /&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/prismv2drop10compositeapplicationguidanc_DCB4/image_thumb_2.png" width="410" height="313" /&gt;&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt; Looks a lot better huh?&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9385502" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/CAL/default.aspx">CAL</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Prism/default.aspx">Prism</category></item><item><title>prism v2 – drop 9 (composite application guidance for wpf and silverlight)</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/01/19/prism-v2-drop-9-composite-application-guidance-for-wpf-and-silverlight.aspx</link><pubDate>Mon, 19 Jan 2009 22:32:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9340600</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9340600.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9340600</wfw:commentRss><description>&lt;p&gt;It’s been a while since my last post. Not that the Prism team has been sitting idle though. &lt;/p&gt;  &lt;p&gt;Last Friday, we’ve released drop 9 of Prism. As we are approaching the end of the Prism v2 project, there are a lot less API changes, as we are mostly focussing on finishing the docs and resolving bugs. We have also spent some time trying to build different application styles (for example, an outlook style app, or a master-detail style app) on top of our library. The results of this exercise was very useful. Unfortunately, they were nothing more than spikes, so we can’t deliver them as part Prism, but we are thinking of doing a bunch of blog posts or webcasts, that describe how to build different application styles on top of Prism. &lt;/p&gt;  &lt;p&gt;You can get drop 9 of Prism here: &lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=21912" href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=21912"&gt;http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=21912&lt;/a&gt;&lt;/p&gt;  &lt;h1&gt;&amp;#160;&lt;/h1&gt;  &lt;h1&gt;What’s in Prism drop 9&lt;/h1&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;New skin for the Stocktrader reference implementation. &lt;/strong&gt;      &lt;br /&gt;We wanted to show a bit more of the power of the WPF and Silverlight platform in our RI, so we have hired an external design bureau to create a new design. It has taken a bit longer to implement than we had hoped. In this drop, we have some of the basic styling in place. Hopefully, we can get the next styling &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Desktop only solutions&lt;/strong&gt;       &lt;br /&gt;Not everybody is interested in developing on both WPF and Silverlight. So that’s why we’ve added ‘WPF’ only solutions. We can’t really add Silverlight only solutions as easily, because the Silverlight projects are linking all the files from the WPF projects. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;New SingleActiveWindowRegionAdapter in the RI        &lt;br /&gt;&lt;/strong&gt;We are demonstrating how to create an adapter in the RI, in this case how to create a popup window and use that as a region. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Several bugs fixed        &lt;br /&gt;&lt;/strong&gt;Lots of testing, prioritizing, bugfixing, retesting, etc.. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Exception stack compression in combination with Unity        &lt;br /&gt;&lt;/strong&gt;Unity is an awesome DI container, but it doesn’t give really clear exception messages if something goes wrong. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The last weeks of a project are always interesting. There are _so_ many ‘little’ things we would have wanted do do, or add to the library. but what seems like a small dev effort, can quickly add up if you also count the test and doc effort. So, we are constantly keeping a critical eye on our prioritized backlog of tasks. Unfortunately, this means there are a bunch of really interesting stuff we would have loved to tackle, but we can’t. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Exception stack compression&lt;/h1&gt;  &lt;p&gt;While building different application styles on top of Prism, we found an interesting problem. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Suppose the following example: You are creating a simple view. In the Module.Initialize(), you are registering the type of the view against a region that’s displayed in the shell. In the constructor of the view, you have made a small programming error, which causes an exception. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So what’s the result?&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;A module initialize error. Ok, that makes sense. But what was the exception message inside that? &lt;em&gt;“Exception occurred at target of invocation.”.&lt;/em&gt; And inside that? A bunch of ServiceLocator, Unity and Objectbuilder errors. Only somewhere at the bottom of the inner exception list you find the exception that caused the problem. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;All these exceptions are perfectly valid from a technical point of view, but not very useful in understanding what’s going wrong.&amp;#160; Ideally, Unity should return a very clear exception message: “Tried to create object X, but could not because of this error message: ‘xyz’”. Unfortunately, Unity does not do this. (After a discussion with the enterprise library team, it turns out that it’s really hard to build this in Unity). I think that developers who are building applications on top of Prism are rarely interested how exactly the DI container builds up it’s objects.&amp;#160; So all the technical inner exceptions are just clutter to them, that’s obscuring what’s really going wrong. &lt;/p&gt;  &lt;p&gt;So we have built some logic to try and find the error in the stack trace that actually points developers in the right direction. The goal was to be able to get the following exception message: “An exception occurred while initializing module X, in the constructor of View X, with exception message “XYZ”. &lt;/p&gt;  &lt;p&gt;So now in Prism, you can use the extension method exception.GetRootException() to try and find the exception that’s actually causing the problem. It won’t be 100% accurate, but it looks like it really helps in getting to the root of the problem more quickly. &lt;/p&gt;  &lt;p&gt;Hopefully you will find this useful to!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9340600" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/CAL/default.aspx">CAL</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Prism/default.aspx">Prism</category></item><item><title>PRISM v2 – dROP 6 (Composite Application Guidance for WPF and Silverlight</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2008/11/22/prism-v2-drop-6-composite-application-guidance-for-wpf-and-silverlight.aspx</link><pubDate>Sat, 22 Nov 2008 04:48:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9132493</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9132493.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9132493</wfw:commentRss><description>&lt;p&gt;Today, we have released the 6th drop of Prism V2 (affectionately known as Compostite Application Guidance for WPF and Silverlight)&lt;/p&gt;  &lt;p&gt;You can download it from:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=19731" href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=19731"&gt;http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=19731&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;What’s new?&lt;/h1&gt;  &lt;p&gt;We’ve had a busy iteration, where we mainly focused on improving some of the design around regions, bugfixes and some code cleanup. This is the list of new items:&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; • RegionContext usable in XAML.    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Introduced a façade on IRegionManager for adding views to regions (push based) and registering view types (pull based)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Expanded the usage of pull based composition in Top Down Composition quickstart     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Silverlight RI is now using the Silverlight Toolkit Controls for line and pie charts     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Regions and RegionContext using an expanded behavior mechanisms     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Have established package load key for project linker     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; • known issue: this still requires the SDK to be installed, however.     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Changed to Add Project Link... dialog     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Resolved a number of code-analysis rules     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • Stock Trader RI is now using pull-view (or top-down) composition for trend line graph     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; • ProjectLinker installer does not have to be started with elevated permissions on Vista&lt;/p&gt;  &lt;p&gt;So like always, please check it out and tell us what you think. &lt;/p&gt;  &lt;p&gt;There are a couple of topics I’d like to go into a bit deeper:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Façade on IRegionManager&lt;/h1&gt;  &lt;p&gt;We’ve introduced a façade on the IRegionManager to make it a bit easier to work with Regions, either from a push or pull based perspective. You can use the following calls:&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyModule : IModule&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Initialize()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Push based composition&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// This code will find &amp;quot;Region1&amp;quot; (it must already be created) and add a new &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// instance of MyView to it. &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.regionManager.AddViewToRegion(&lt;span style="color: #006080"&gt;&amp;quot;Region1&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MyView());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Pull based composition&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// This code will register a viewtype with a region. Whenever Region2 is &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// displayed, it will automatically be populated by a new instance of MyView()&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// created by the ServiceLocator. &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.regionManager.RegisterTypeWithRegion(&lt;span style="color: #006080"&gt;&amp;quot;Region2&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(MyView());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;     &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// Variation on pull based composition:&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// This code uses a delegate that creates the view to be pulled. This is great&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         &lt;span style="color: #008000"&gt;// if your presenters are responsible for creating the views. &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.regionManager.RegisterTypeWithRegion(&lt;span style="color: #006080"&gt;&amp;quot;Region2&amp;quot;&lt;/span&gt;, &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;                () =&amp;gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MyViewPresenter().View());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;     }   &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; IRegionManager regionManager;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;     &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; MyModule(IRegionManager regionManager)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.regionManager = regionManager;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;     }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt; }&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;In the previous drop, we have introduced the IRegionViewRegistry, where you could register views to be pulled (Previously called RegionContentRegistry). This allows you to plug in your own registration module. However, we figured that for simple scenario’s, you don’t need to know about this implementation detail. &lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h1&gt;RegionContext&lt;/h1&gt;

&lt;p&gt;An other thing we’ve improved is the RegionContext. Like I mentioned in my previous blogpost, the RegionContext is a way that a view that hosts a region can share some of it’s information with any childviews that are loaded into it’s region. The RegionContext now supports 2 way databinding and is very configurable using RegionBehaviors. &lt;/p&gt;

&lt;p&gt;The following codesnippet shows how to use the RegionContext in XAML:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ContentControl&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x:Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;SelectionPanel&amp;quot;&lt;/span&gt;
                &lt;span style="color: #ff0000"&gt;cal:RegionManager&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;RegionName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{x:Static local:RegionNames.SelectionRegion}&amp;quot;&lt;/span&gt;
                &lt;span style="color: #ff0000"&gt;cal:RegionManager&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;RegionContext&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding Path=SelectedEmployee, Mode=TwoWay}&amp;quot;&lt;/span&gt;
                &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;And in the views, you can get access to the regioncontext like this:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;// To get the value from the regioncontext, from inside the view in a region:&lt;/span&gt;
var regionContextValue = RegionExtensions.GetRegionContext(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).Value

&lt;span style="color: #008000"&gt;// To change the RegionContext:&lt;/span&gt;
RegionExtensions.GetRegionContext(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).Value = newValue

&lt;span style="color: #008000"&gt;// And to subscribe to change events:&lt;/span&gt;
RegionExtensions.GetRegionContext(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;).PropertyChanged += RegionContext_PropertyChanged&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;RegionBehaviors&lt;/h1&gt;

&lt;p&gt;We’ve received a number of questions from people who liked the functionality where a region would automatically pull in instances of all registered viewtypes. However, they really wanted the ability to influence which views were pulled in. This was one of the reasons why we moved to implement a list of behaviors on a region. &lt;/p&gt;

&lt;p&gt;We had the following requirements:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You have to be able to define regions in XAML and Code &lt;/li&gt;

  &lt;li&gt;You should be able to bind the RegionContext in XAML or set it through code. &lt;/li&gt;

  &lt;li&gt;The RegionContext should be available for views inside a region. But a view can either be an UserControl (thus a dependencyobject) or a ViewModel (poco) &lt;/li&gt;

  &lt;li&gt;A region should be able to pull in registered views (but in a way you can influence it) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This lead us to the conclusion a region has a couple of behaviors. We will provide a number of behaviors by default, which you can change globally, or for a specific Region instance. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PRISMv2dROP6cOMPOSITEaPPLICATIONgUIDANCE_E156/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PRISMv2dROP6cOMPOSITEaPPLICATIONgUIDANCE_E156/image_thumb.png" width="343" height="58" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h1&gt;Default behaviors&lt;/h1&gt;

&lt;p&gt;We have built a number of behaviors:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For synchronizing the RegionContext, we’ve built two behaviors:&lt;strong&gt; SyncRegionContextBehavior&lt;/strong&gt;, which will synchronize the regioncontext dependency property, defined in XAML with the Context property on the region. To synchronize the Regions Context property with childviews (we only support usercontrols now) we have the &lt;strong&gt;BindRegionContextToDependencyObjectBehavior&lt;/strong&gt;. &lt;/li&gt;

  &lt;li&gt;For the TopDown (pull based) composition, we’ve created the &lt;strong&gt;AutoPopulateBehavior&lt;/strong&gt;. This will query the RegionViewRegistry for all viewtypes defined on the view and autopopulate it. &lt;/li&gt;

  &lt;li&gt;To register the region with the regionmanager, we’ve created the &lt;strong&gt;RegionManagerRegistrationBehavior. &lt;/strong&gt;&lt;/li&gt;

  &lt;li&gt;Some views are aware of the fact that they are ‘active’ or not, by implementing the IActiveAware. The active property is set on them by the &lt;strong&gt;RegionActiveAwareBehavior&lt;/strong&gt;. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This diagram shows the behaviors we have built now:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PRISMv2dROP6cOMPOSITEaPPLICATIONgUIDANCE_E156/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PRISMv2dROP6cOMPOSITEaPPLICATIONgUIDANCE_E156/image_thumb_2.png" width="777" height="610" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h1&gt;Customizing the behaviors for all regions &lt;/h1&gt;

&lt;p&gt;The default behaviortypes are registered in the UnityBootstrapper. By overriding the ConfigureDefaultRegionBehaviors method you can add new behaviortypes, replace existing types or remove behaviors. You can also choose to register a different IRegionBehaviorFactory, if you require custom initialization for your behaviors. &lt;/p&gt;

&lt;p&gt;The default behaviors are added by the RegionAdapterBase. In the RegionAdapter you can decide to add behaviors for specific control types. For example, we had to build a behavior to get the TabControl in silverlight to work properly. (It doesn’t derive from selector like in WPF). &lt;/p&gt;

&lt;h1&gt;Customizing the behaviors for a single region instance&lt;/h1&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;p&gt;Sometimes, you want to add a behavior to a specific instance of a region. For example, when you want to change the way views are pulled into a region. To do this, you have to detect that the region has been created, but before the default region behaviors are attached. You can do that by hooking up an eventhandler in the constructor of the view that’s hosting a region. &lt;/p&gt;

&lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;
  &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;
    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;// From the TopDownUIComposition Quickstart&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; EmployeesView()&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     InitializeComponent();&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     RegionExtensions.GetObservableRegion(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.SelectionPanel).PropertyChanged += &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, PropertyChangedEventArgs args)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (args.PropertyName == &lt;span style="color: #006080"&gt;&amp;quot;Value&amp;quot;&lt;/span&gt;)&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         {&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;             &lt;span style="color: #008000"&gt;// The region has just been created, but (Very Important), the default behaviors have not been added yet. &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;             &lt;span style="color: #008000"&gt;// This gives you a chance to add your own custom behaviors. If you use the same key as a default behavior&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;             &lt;span style="color: #008000"&gt;// it will replace a default behavior. &lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;             IRegion region = RegionExtensions.GetObservableRegion(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.SelectionPanel).Value;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;             region.Behaviors.Add(AutoPopulateRegionBehavior.BehaviorKey, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; CustomAutoPopulateBehavior());&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         }&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;     };&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The ‘GetObservableRegion’ method will return an object that you can monitor to when the region is created. The .Value property will hold the new region. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9132493" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/CAL/default.aspx">CAL</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Prism V2 – Drop 4</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2008/10/24/prism-v2-drop-4.aspx</link><pubDate>Sat, 25 Oct 2008 01:54:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9015367</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9015367.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9015367</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt; Today, We have put an other drop of Prism V2 (Composite application guidance for WPF and Silverlight) online. You can download it from here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=18750" href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=18750"&gt;http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=18750&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;New in Prism V2 - Drop 4&lt;/h1&gt;  &lt;p&gt;This sprint was mainly focused around UI Composition. We have ported the Region functionality from Prism V1 over so it also works in Silverlight. Then we also addressed a different style of visual composition, we’re calling Top Down composition. I’m going to drill into those composition styles later in this post. &lt;/p&gt;  &lt;h1&gt;&amp;#160;&lt;/h1&gt;  &lt;h1&gt;Top down vs. Bottom up composition&lt;/h1&gt;  &lt;p&gt;In the last couple of weeks, we’ve had a lot of discussions around Visual Composition patterns. &lt;/p&gt;  &lt;h2&gt;Bottom up composition&lt;/h2&gt;  &lt;p&gt;Prism V1 used a regions to support Bottom Up composition. As a developer, you can define and name regions on your screen. When developing modules, you can use the names of these regions to push views into the regions. At first, we called this “push” based composition, because modules push their views into named regions. The diagram below shows an example of push based composition. We’re also calling this bottom up composition, because lower level modules push their views into the regions of higher level views. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PrismV2Drop4_DFBC/image_20.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PrismV2Drop4_DFBC/image_thumb_9.png" width="521" height="360" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Although this composition model allows for a highly decoupled and modular approach to UI development, we received some feedback that in some scenario’s it can be a bit to complex. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Top down composition&lt;/h2&gt;  &lt;p&gt;With top down composition we took a different approach. Usually, developers are very comfortable with the usage of UserControls. It’s quite common for developers to split up a view into several UserControls to reduce complexity (divide and conquer) and to improve reuse of visual elements. Now it’s quite easy to create controls and place them in different assemblies. However, in order to use those assemblies, the shell has to have a reference to the assemblies that hold the user controls. This goes against the principles of modular development where modules can be versioned, and deployed seperately. &lt;/p&gt;  &lt;p&gt;We wanted to allow a model where you can visually compose your application in the same way as using UserControls, but without sacrificing modularity. To do this, we introduced a Top Down composition model:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PrismV2Drop4_DFBC/image_22.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PrismV2Drop4_DFBC/image_thumb_10.png" width="512" height="362" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So instead of the shell having a hard reference to the CustomerModule and putting a CustomerView directly on the ShellView, you put a ContentControl in the place where you want the user control. Then you use an attached property ViewType to specify what kind of View you want to display here, by specifying the interface of the view to display. The view interfaces can be defined in a seperate (Interface) module or in the shell. &lt;/p&gt;  &lt;p&gt;When a module get’s initialized, it typically registers it’s views to the &lt;a href="http://msdn.microsoft.com/en-us/library/cc707845.aspx"&gt;DI container&lt;/a&gt;. For example, the CustomerModule will tell the container that it can provide an implementation of the ICustomerView, because it registers the CustomerView type with the ICustomerView interface. Now after module initialization, the ShellView will ask the DI container for an implementation of ICustomerView. This will of course return the CustomerView, so it can then be shown in the ContentControl. Essentially, the ContentControl on the ShellView is pulling the CustomerView in from the CustomerModule, without having a direct reference to that module. We are calling this “Top Down” composition, because the Higher level modules define which views are displayed where. &lt;/p&gt;  &lt;p&gt;This is an example (from the TopDownCompositionQuickstart) on how you specify a view that’s pulled into the shell in XAML:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ContentControl&lt;/span&gt; 
    &lt;span style="color: #ff0000"&gt;Regions:ContentController&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;ViewType&lt;/span&gt;=
         &lt;span style="color: #0000ff"&gt;&amp;quot;TopDownComposition.Modules.Employee.IEmployeesListView, EmployeeModule.Silverlight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You might notice 2 things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;The viewtype is a string
      &lt;br /&gt;&lt;/strong&gt;At first we wanted to use the type of the interface directly. Unfortunately, this doesn’t work in Silverlight, because you cannot create types in XAML, because {x:Type} doesn’t work. But working with strings isn’t too bad. We’re planning to make the resolving logic pluggable. This way, you could for example use logical names, exported by your modules, to identify and retrieve the views. In fact, the &lt;a href="http://code.msdn.microsoft.com/mef"&gt;MEF framework&lt;/a&gt; also works like that. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;The viewtype is a really long string
      &lt;br /&gt;&lt;/strong&gt;To make working with those really long strings a bit more bearable, we’re also thinking of building a custom type resolver. Since 99.9% of the times the full typename (Namespace.TypeName) is unique, you can get away with just specifying that and let the framework figure out which assembly the type came from.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We’re also considering moving the View resolving functionality from the ContentController to the RegionManager. Even though technically this has nothing to do with regions, conceptually it’s very similar. A region specifies where you want to display visual elements from other modules. In the top down approach, you specify the content via it’s interface and in the bottom up approach you give it a name so others can push views into it. But it’s still a placeholder for views. &lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Hopefully you’ve found this post useful in explaining what we’re building. As always, we are very open to feedback. If you don’t like something we do, please tell us! Also if you do like something, tell us that as well! It might just prevent us from changing something you are already happy with :) &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9015367" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/CAL/default.aspx">CAL</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Prism V2 (Composite Application Guidance) – Drop 3 is out</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2008/10/14/prism-v2-drop-3-is-out.aspx</link><pubDate>Tue, 14 Oct 2008 23:19:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000006</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9000006.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9000006</wfw:commentRss><description>&lt;p&gt;Yesterday, we’ve put the third drop of the Prism V2 project (Composite Application Guidance for WPF and Silverlight) online. &lt;/p&gt;  &lt;p&gt;You can download it from here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=18184" href="http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=18184"&gt;http://www.codeplex.com/CompositeWPF/Release/ProjectReleases.aspx?ReleaseId=18184&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this blog post I’m going to answer the following questions:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;What’s new in this drop?&lt;/li&gt;    &lt;li&gt;What are the Prism V2 module loading scenario’s?&lt;/li&gt;    &lt;li&gt;How is module loading implemented in Prism V2?&lt;/li&gt;    &lt;li&gt;Why the change from module enumerators to module catalogs?&lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;What’s new in this drop?&lt;/h1&gt;  &lt;p&gt;In this drop, we are starting to address Modularity. We’ve laid down the foundations for two new quickstarts: a static loading quickstart and a remote module loading quickstart. The most interesting of these two is the remote module loading quickstart because it does asynchronous downloading of modules from XAP files, and introduces a new XAML markup based way of defining modules. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h3&gt;Why address modularity in the third drop?&lt;/h3&gt;  &lt;p&gt;It might be interesting to address why we haven’t started to address modularity until this third drop. In the first two drops, we’ve mostly focused around multi targeting solutions between WPF and Silverlight. This might seem a bit strange, considering Prism is focused on composition. One of the goals of Prism V2 is to enable you to create applications that target WPF on the desktop and Silverlight from the browser using mostly the same codebase. we quickly found that targeting both Silverlight and WPF is not easy, so in true agile fashion, we tried to tackle this high risk unknown factor first. The added benefit is that we are dogfooding the tool we created to help multitargeting and can start capturing guidance on multi targeting applications early. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Prism V2 Module loading scenario’s&lt;/h1&gt;  &lt;p&gt;When designing the module loading strategy for Prism V2, we first had to come up with the scenario’s we wanted to address. &lt;/p&gt;  &lt;p&gt;In a desktop application, you would typically want to create a modular application if you wanted to develop, version and deploy modules independently from each other. Of course these reasons are still valid for Silverlight applications, but we found that in Silverlight there is an other really important for creating a modular application: Minimizing download size. Especially on the web, users are very impatient. So you want users to wait for the minimum amount of time to start using your application. If you deploy your application in one massive 20 Mb Xap file, you are not going to end up with very happy customers. &lt;/p&gt;  &lt;p&gt;So you could also use modularity to minimize download time. We defined three categories of modules for this: Core, background and On demand modules. &lt;/p&gt;  &lt;h2&gt;“Core” modules&lt;/h2&gt;  &lt;p&gt;There is going to be a group of modules that are the bare minimum for your application to run. Most of the time, this will be the shell, shared common infrastructure modules with shared services and one or more functional modules that the user absolutely needs to productively use the application. Of course, speed is essential, so you should try to keep these modules to the minimum size possible. &lt;/p&gt;  &lt;p&gt;The core modules, will typically be packaged in the main Xap file. While this main XAP file is downloaded, you can use the built in Silverlight functionality to display a splash screen while the main XAP files are downloaded. Once the main XAP file is downloaded, the core modules will get initialized and the application will start up. &lt;/p&gt;  &lt;h2&gt;Background downloaded modules&lt;/h2&gt;  &lt;p&gt;Now there might be a couple of modules that are really important to your application, but the user doesn’t need them right away. However you don’t want them to wait for the module to get downloaded once they actually do need them. So to improve the user experience, you want to download these modules in the background. Modules will be downloaded in order and initialized when they are downloaded.&lt;/p&gt;  &lt;h2&gt;On demand downloaded modules &lt;/h2&gt;  &lt;p&gt;Then you might have a group of modules that are only used by a very select group of users (IE: an administration module). This will mostly help in minimizing the installation bandwidth used, because it’s not needlessly downloading assemblies. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Module loading in Prism V2&lt;/h1&gt;  &lt;p&gt;In Prism V1, there was no concept of module downloading, because all modules where assumed to be available on the file system. Now for silverlight, this approach only works for assemblies that are present in the main XAP file. In Prism V2, we want to support retrieving modules from elsewhere. We’ll support downloading XAP files for Silverlight, but nothing prevents you from downloading modules from the web or from a database in WPF. &lt;/p&gt;  &lt;p&gt;This image displays roughly how the module loading pieces relate to each other:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PrismV2Drop3isout_9DC7/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/PrismV2Drop3isout_9DC7/image_thumb_2.png" width="500" height="285" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The bootstrapper creates the Catalog and the Module manager. Then it kickstarts the modulemanager to start initializing the modules. &lt;/li&gt;    &lt;li&gt;The Catalog holds a list of ModuleInfoGroups which is a collection of module info’s. We’ve created a grouping, to make it easier to define which containers (XAP files) hold which modules. It’s also a convenient way to create a group of modules that are ‘Core’. &lt;/li&gt;    &lt;li&gt;The ModuleManager is responsible for coordinating the whole module retrieval and loading process. It will query the Catalog for core modules, background modules. It will also be the point where you hook up events to get notified when modules are downloaded. &lt;/li&gt;    &lt;li&gt;The moduleManager has a list of ModuleRetrievers. We are likely to ship only one retriever: the XapModuleRetriever that downloads silverlight modules. However, this way you can plug in your own retrieval strategies (IE, load modules from a database, webservice or some other means)&lt;/li&gt;    &lt;li&gt;If a module is present (either it was already on the filesystem, or it has been retrieved) the ModuleManager calls the ModuleLoader to instantate the module and call the Initialize method on it. This is the place where you can plug in your own module loading and initialization strategy. &lt;/li&gt; &lt;/ol&gt;  &lt;h1&gt;Defining module information in XAML&lt;/h1&gt;  &lt;p&gt;One other new thing we are supporting is defining module information in XAML. This is different from defining module info’s from a config file, because loading the XAML actually instantiates the ModuleInfo files. This way, it’s easier to create your own ModuleInfo files and extend it with custom properties. Defining modules in XAML looks like this:&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleCatalogBuilder&lt;/span&gt; &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;                &lt;span style="color: #ff0000"&gt;xmlns:x&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;                &lt;span style="color: #ff0000"&gt;xmlns:Modularity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;clr-namespace:Microsoft.Practices.Composite.Modularity;assembly=Microsoft.Practices.Composite.Silverlight&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleInfoGroup&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Ref&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ModuleY.Silverlight.xap&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;InitializationMode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;WhenAvailable&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleInfo&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ModuleName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ModuleY&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ModuleType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ModuleY.ModuleY, ModuleY.Silverlight, Version=1.0.0.0&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleInfoGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleInfoGroup&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Ref&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ModuleZ.Silverlight.xap&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;InitializationMode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;WhenAvailable&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleInfo&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ModuleName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ModuleZ&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ModuleType&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;ModuleZ.ModuleZ, ModuleZ.Silverlight, Version=1.0.0.0&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleInfoGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Modularity:ModuleCatalogBuilder&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

    &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;This example (from the RemoteModuleLoading quickstart) has two XAP files. Each XAP file has a single ModuleInfo. These modules will be downloaded on a background thread and initialized when they have been downloaded (WhenAvailable)&lt;/p&gt;

&lt;h1&gt;Moving from ModuleEnumerators to Catalogs of modules&lt;/h1&gt;

&lt;p&gt;In Prism V1, we have the concept of module enumerators that define which modules are used by the application. For instance, the DirectoryLookupModuleEnumerator would find all modules in a specific directory. After many discussions, we found that this name is a bit confusing. If you think about it, an enumerator in .Net takes a collection and provides a way to walk through that collection. The prism ModuleEnumerators acted more like Module Info providers because they read module information from a certain location (IE: a directory or a config file) and returned the list of module info’s. &lt;/p&gt;

&lt;p&gt;In Prism V2, we have defined the concept of a Catalog (of modules). A catalog contains the list of all the modules that are available to the application. Other components, like the ModuleManager can query the catalog for specific groups of modules. Like: “Give me all the Core modules”. Or “Give me all the modules to download in the background”.&lt;/p&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;There is a bunch of interesting stuff going on in this drop. We are still in the middle of a bunch of changes, but it does give a clear indication of the direction we’re taking. &lt;/p&gt;

&lt;p&gt;As always, let us know what you guys think, either by commenting here, commenting on the CodePlex site, or by sending us an E-mail.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9000006" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Composite Application Guidance for WPF has landed</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2008/07/04/composite-application-guidance-for-wpf-has-landed.aspx</link><pubDate>Fri, 04 Jul 2008 21:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8690387</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/8690387.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=8690387</wfw:commentRss><description>&lt;P&gt;My new colleagues at patterns &amp;amp; practices have just delivered a great new deliverable around creating composite applications in WPF. Check it out at:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://msdn.microsoft.com/en-us/library/cc707819.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc707819.aspx&lt;/A&gt;&amp;nbsp;or at: &lt;A href="http://www.codeplex.com/CompositeWPF"&gt;http://www.codeplex.com/CompositeWPF&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This deliverable contains:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Composite Application Library components.&lt;/LI&gt;
&lt;LI&gt;Guidance around creating composite applications, including detailled descriptions of common UI design patterns.&lt;/LI&gt;
&lt;LI&gt;Reference implementation&lt;/LI&gt;
&lt;LI&gt;Quickstart applications that demonstrate specific aspects of CAL&lt;/LI&gt;
&lt;LI&gt;Lots of hands on labs&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;Great stuff!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8690387" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/CAL/default.aspx">CAL</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/WPF/default.aspx">WPF</category></item><item><title>First Post</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2008/06/26/first-post.aspx</link><pubDate>Thu, 26 Jun 2008 21:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8657704</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/8657704.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=8657704</wfw:commentRss><description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;Wecome to my Blog. I've just started my new job at the patterns &amp;amp; practices team in Redmond. I hope to write some interesting blogposts about the stuff I'm working on. Let me know if there is anything you'd like me to blog about :)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Erwin...&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8657704" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category></item></channel></rss>