<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.oosterkamp.nl/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>Thomas Huijer - Compiler says no....</title><link>http://blogs.oosterkamp.nl/blogs/thomas/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>WCF and LINQ: beware of deferred execution</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/09/08/wcf-and-linq-beware-of-deferred-execution.aspx</link><pubDate>Thu, 08 Sep 2011 14:07:10 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:334</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=334</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/09/08/wcf-and-linq-beware-of-deferred-execution.aspx#comments</comments><description>&lt;pre&gt;&lt;font size="3" face="Calibri"&gt;When I was teaching WCF in Oslo this week, a student got an Exception from the client when calling this method on the server:&lt;/font&gt;&lt;/pre&gt;

&lt;pre&gt;&amp;#160;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font size="4"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span&gt;&lt;font color="#2b91af"&gt;IEnumerable&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;Product&lt;/font&gt;&lt;/span&gt;&amp;gt; GetProductsForProductModel(&lt;span&gt;&lt;font color="#0000ff"&gt;int&lt;/font&gt;&lt;/span&gt; productModelID)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;&lt;font color="#000000"&gt;  &lt;/font&gt;using&lt;/font&gt;&lt;/span&gt; (&lt;span&gt;&lt;font color="#2b91af"&gt;AdventureWorks2008R2Entities&lt;/font&gt;&lt;/span&gt; context = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span&gt;&lt;font color="#2b91af"&gt;AdventureWorks2008R2Entities&lt;/font&gt;&lt;/span&gt;())&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;  {&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;    &lt;span&gt;&lt;font color="#0000ff"&gt;return&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;      &lt;span&gt;&lt;font color="#0000ff"&gt;from&lt;/font&gt;&lt;/span&gt;&amp;#160;&lt;span&gt;&lt;font color="#2b91af"&gt;Product&lt;/font&gt;&lt;/span&gt; p &lt;span&gt;&lt;font color="#0000ff"&gt;in&lt;/font&gt;&lt;/span&gt; context.Product&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;      &lt;span&gt;&lt;font color="#0000ff"&gt;where&lt;/font&gt;&lt;/span&gt; p.ProductModel.ProductModelID == productModelID&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;      &lt;span&gt;&lt;font color="#0000ff"&gt;select&lt;/font&gt;&lt;/span&gt; p;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;  }&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;pre style="background:white;"&gt;&lt;font style="font-size:18pt;"&gt;&lt;font face="Consolas"&gt;&lt;font size="4"&gt;}&lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;&lt;font size="3"&gt;At first there seemed nothing wrong with the code and I assmumed it was caused by the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.maxreceivedmessagesize.aspx" target="_blank"&gt;maxReceivedMessageSize&lt;/a&gt; setting. But increasing that didn’t help. Then it struck me…we are returning a query and not a resultset. So when the &lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx" target="_blank"&gt;DataContractSerializer&lt;/a&gt; started to fetch the results from the query (when it was serializing our result), the used &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx" target="_blank"&gt;ObjectContext&lt;/a&gt; was already disposed. When we enabled &lt;a href="http://msdn.microsoft.com/en-us/library/aa751795.aspx" target="_blank"&gt;Tracing and MessageLogging&lt;/a&gt; we found out that this was indeed the case: we got an ObjectDisposedException from the ObjectContext. The fix was easy, calling ToList() on the query before returning did the trick…&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="3"&gt;Deferred execution is a great feature…sometimes it just bites you.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=334" width="1" height="1"&gt;</description></item><item><title>WCF Service in PreCompiled ASP.NET web application</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/09/06/wcf-service-in-precompiled-asp-net-web-application.aspx</link><pubDate>Tue, 06 Sep 2011 07:34:17 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:333</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=333</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/09/06/wcf-service-in-precompiled-asp-net-web-application.aspx#comments</comments><description>&lt;p&gt;I got an email from a customer that reported a bugin the Web Deployment Tool 2010. Maybe it saves you some time if you ever encounter this. This is the translated text:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;When we deploy our webapplication, we precompile it first using the Web Deployment Tool 2010. While testing, we found out that the service could not be located. After some digging it turned out the problem was in the .compiled file of the service. &lt;/p&gt;  &lt;p&gt;&lt;i&gt;See this post fromTom Fuller&lt;/i&gt; : &lt;a href="http://social.msdn.microsoft.com/forums/en-US/wcf/thread/8c897f8e-2143-450e-a9f4-97d1f8702da7"&gt;http://social.msdn.microsoft.com/forums/en-US/wcf/thread/8c897f8e-2143-450e-a9f4-97d1f8702da7&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We solved it by using MSBuildTasks in the Web Deployment project (&lt;a href="http://msbuildtasks.tigris.org/"&gt;http://msbuildtasks.tigris.org/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;With that, we replacing the absolute location of the file with the “~” sign.&lt;/p&gt;  &lt;p&gt;&amp;lt;FileUpdate Files=&amp;quot;..\..\Output\Web\Deployment\bin\documentservice.svc.989dc2fb.compiled&amp;quot; Regex=&amp;quot;/Donau Web.csproj&amp;quot; ReplacementText=&amp;quot;~&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;We also remove all references to the ASP.NET folders like “App_”:&lt;/p&gt;  &lt;p&gt;&amp;lt;FileUpdate Files=&amp;quot;..\..\Output\Web\Deployment\bin\documentservice.svc.989dc2fb.compiled&amp;quot; Regex=&amp;quot;\|App_global.asax, Version=0\.0\.0\.0, Culture=neutral, PublicKeyToken=417399dd0d17e25b\|&amp;quot; ReplacementText=&amp;quot;|&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;FileUpdate Files=&amp;quot;..\..\Output\Web\Deployment\bin\documentservice.svc.989dc2fb.compiled&amp;quot; Regex=&amp;quot;\|App_GlobalResources, Version=0\.0\.0\.0, Culture=neutral, PublicKeyToken=417399dd0d17e25b\|&amp;quot; ReplacementText=&amp;quot;|&amp;quot; /&amp;gt;&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=333" width="1" height="1"&gt;</description><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/WCF/default.aspx">WCF</category></item><item><title>Improving Legacy Code session at the DevDays 2011</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/05/19/improving-legacy-code-session-at-the-devdays-2011.aspx</link><pubDate>Thu, 19 May 2011 13:21:05 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:330</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=330</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/05/19/improving-legacy-code-session-at-the-devdays-2011.aspx#comments</comments><description>&lt;p&gt;Demo&amp;#39;s from my Improving Legacy Code session at the DevDays 2011 are available here: &lt;a href="http://bit.ly/mNMJac"&gt;http://bit.ly/mNMJac&lt;/a&gt;    &lt;br /&gt;PowerPoint-slides are here: &lt;a href="http://bit.ly/lQuNCH"&gt;http://bit.ly/lQuNCH&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Let me know if you have any questions at &lt;a href="mailto:thomas@oosterkamp.nl"&gt;thomas@oosterkamp.nl&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=330" width="1" height="1"&gt;</description><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/.NET+Framework/default.aspx">.NET Framework</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Trick/default.aspx">Trick</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/DevDays/default.aspx">DevDays</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Legacy/default.aspx">Legacy</category></item><item><title>Caliburn Micro events without having to implement IHandle</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/03/28/caliburn-micro-events-without-having-to-implement-ihandle.aspx</link><pubDate>Mon, 28 Mar 2011 19:42:27 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:329</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=329</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2011/03/28/caliburn-micro-events-without-having-to-implement-ihandle.aspx#comments</comments><description>&lt;p&gt;I like Caliburn.Micro. I like it a lot. I love the way it’s so small and compact and yet so powerful. Right now we’re using it in a Silverlight 4 project and I have yet to encounter something I really don’t like. Nonetheless….there’s something I felt was a bit more work than I liked: the way the EventAggregator works. Publishing an event is plain and simple: you just call Publish on the EventAggregator and pass it an instance of your event class:&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:12pt;"&gt;eventAggregator.Publish(&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;() { Value = &lt;/font&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;Hi!&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; });
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;If you want to subscribe to an event, you basically you have to implement IHandle&amp;lt;T&amp;gt; where T is the class that represents your event. This is how it’s usually done:&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;class&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MainPageViewModel&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; : &lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;IHandle&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;gt;
{&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;  public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; Handle(&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font color="#000000"&gt; message)&amp;nbsp;&amp;nbsp; &lt;br /&gt;  {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#000000"&gt;StringValue = &lt;/font&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;Received: &amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; + ev.Value;&lt;/font&gt;
&lt;font color="#000000"&gt;&amp;nbsp; }
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;Not too bad if you have just one or a few eventhandlers in your ViewModel. But your class declaration gets more cluttered with all IHandle&amp;lt;T&amp;gt; declarations if you have more than a few. I didn’t like that. I wanted to be able to add a lambda expression in the Subscribe method like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:12pt;"&gt;eventAggregator.Subscribe&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;gt;(&lt;br /&gt;       ev =&amp;gt; StringValue = &lt;/font&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;Received: &amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; + ev.Value);&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;The good news is is that I have found a real easy way to do that. Just three very simple classes are needed. First, I created a MessageHandler&amp;lt;T&amp;gt; that implements IHandle&amp;lt;T&amp;gt;. The constructor of MessageHandler&amp;lt;T&amp;gt; takes an Action&amp;lt;T&amp;gt; as an argument:&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;class&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MessageHandler&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt;: &lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;IHandle&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt;
{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;private&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;readonly&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;Action&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt; _messageHandler;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; MessageHandler( &lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;Action&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt; messageHandler )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _messageHandler = messageHandler;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font color="#000000"&gt; Handle(T message)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;if&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; (_messageHandler != &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;null&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _messageHandler(message);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;So, now I’m able to Subscribe to the event like this:&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:12pt;"&gt;eventAggregator.Subscribe&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font color="#000000"&gt;&amp;gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MessageHandler&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;gt;( &lt;br /&gt;                 ev =&amp;gt; StringValue = &lt;/font&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;Received: &amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; + ev.Value) );
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;Already better because I don’t have to implement IHandle&amp;lt;T&amp;gt; in my ViewModel anymore. But a bit more awkward to use than the original implementation. So I created a extension method on EventAggregator that made subscribing easier.&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;static&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;class&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;EventAggregatorExtension&lt;/font&gt;&lt;/span&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;static&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; Subscribe&amp;lt;T&amp;gt;( &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;EventAggregator&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; eventAggregator, &lt;br /&gt;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;                                                        Action&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt; eventHandler )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eventAggregator.Subscribe(&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MessageHandler&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt;(eventHandler));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font color="#000000" size="3" face="Consolas"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;And we’re done! Now we can subscribe to events like this:&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&lt;font style="font-size:12pt;"&gt;eventAggregator.Subscribe&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;gt;( &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ev =&amp;gt; StringValue = &lt;/font&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;Received: &amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; + ev.Value); &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;But wait…we’re not done. Because Caliburn Micro is using a list of WeakRefereces, the Garbage Collector will collect our MessageHandler objects! So message handlers will no longer be called after a garbage collection. So the ViewModel needs to maintain references to every MessageHandler&amp;lt;T&amp;gt; that it creates. In order to do that I created a MessageHandlerList. The ViewModel holds a reference to the MessageHandlerList and that holds references to each MessageHandler&amp;lt;T&amp;gt; that is created:&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;class&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MessageHandlerList&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;private&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;List&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;object&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;gt; list = &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;List&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;object&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;&amp;gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;private&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;readonly&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;EventAggregator&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; _aggregator;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; MessageHandlerList(&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;EventAggregator&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt; aggregator)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _aggregator = aggregator;&lt;br /&gt;    }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; Subscribe&amp;lt;T&amp;gt;(&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;Action&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font color="#000000"&gt;&amp;lt;T&amp;gt; eventHandler)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; list.Add(_aggregator.Subscribe&amp;lt;T&amp;gt;(eventHandler));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; Publish&amp;lt;T&amp;gt;(T message)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _aggregator.Publish&amp;lt;T&amp;gt;(message);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;So when we want to subscribe to multiple Messages, you first create a new MessageHandlerList and pass it an existing (or new) EventAggregator in the constructor. And then call Subscribe and Publish on the MessageHandlerList. Subscribing to Messages should be done through the MessageHandlerList, but Publishing messages can be done through the MessageHandlerList or the normal way using the EventAggregator directly:&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MessageHandlerList&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; events = &lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;MessageHandlerList&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;EventAggregator&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;());&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;pre style="list-style-type:disc;background:white;"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font face="Consolas"&gt;&lt;font color="#000000"&gt;events.Subscribe&amp;lt;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font style="font-size:12pt;"&gt;&lt;font color="#000000"&gt;&amp;gt;(ev =&amp;gt; button2.Content += ev.Value);&lt;br /&gt;events.Publish(&lt;/font&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;/font&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;SendStringEvent&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt;() { Value = &lt;/font&gt;&lt;span&gt;&lt;font color="#a31515"&gt;&amp;quot;Hi!&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;font color="#000000"&gt; });&lt;/pre&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=329" width="1" height="1"&gt;</description></item><item><title>Reporting Services 2008 without IIS</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/09/07/reporting-services-2008-without-iis.aspx</link><pubDate>Tue, 07 Sep 2010 18:48:05 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:318</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=318</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/09/07/reporting-services-2008-without-iis.aspx#comments</comments><description>&lt;p&gt;When teaching a Reporting Services course today, I was told by an attendee that Reporting Services 2008 could be installed without the need for IIS. I read about that, but assumed that it had an internal webserver or something similar that you could activate if you didn’t have IIS (I guess I didn’t really read the documentation, I just made some assumptions). But the attendee pointed me to a webpage that showed how Reporting Services work without IIS. Instead of an internal webserver, Microsoft implemented Reporting Services 2008 as an extension to &lt;a href="http://learn.iis.net/page.aspx/101/#Hypertext" target="_blank"&gt;HTTP.SYS&lt;/a&gt;, called an HTTP Listener. That means that Reporting Services gets passed requests for it and IIS never gets those requests. This means that you actually have two processes reacting to requests on port 80. And that’s possible because HTTP.SYS is the process that actually listens on port 80 and hands those requests to either Reporting Services or IIS. &lt;/p&gt;  &lt;p&gt;Read more about it &lt;a href="http://msdn.microsoft.com/en-us/library/bb630409.aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=318" width="1" height="1"&gt;</description><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Reporting+Services/default.aspx">Reporting Services</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/IIS/default.aspx">IIS</category></item><item><title>Modifying the generated code from RIA Services</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/06/22/modifying-the-generated-code-from-ria-services.aspx</link><pubDate>Tue, 22 Jun 2010 10:27:37 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:316</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=316</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/06/22/modifying-the-generated-code-from-ria-services.aspx#comments</comments><description>&lt;p&gt;Today at a client I had the need to modify the code that RIA Services generates. It is certainly possible, but not as easy as modifying a &lt;a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx" target="_blank"&gt;T4 template&lt;/a&gt;. It turns out you have to derive a class from System.ServiceModel.DomainServices.Server.CodeProcessor. If you put the DomainIdentifierAttribute on your DomainService class, you can specify your own CodeProcessor.&lt;/p&gt;  &lt;p&gt;The CodeProcessor gets an tree with the CodeDOM of the code that is going to be generated. The MSBuild task responsible for generating the code, hands that to your CodeProcessor so you can add, remove or change anything you want. See an example of a CodeProcessor &lt;a href="http://weblogs.thinktecture.com/ingo/2010/06/fixing-ria-servicess-an-entitykey-value-cannot-be-null-with-a-codeprocessor.html" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;I’ve read somewhere that the next version of RIA Services is going to support T4 Templates, but for now I can live with it.&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=316" width="1" height="1"&gt;</description></item><item><title>Configure Windows to Log in to TFS Automatically</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/04/08/configure-windows-to-log-in-to-tfs-automatically.aspx</link><pubDate>Thu, 08 Apr 2010 19:48:45 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:299</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=299</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/04/08/configure-windows-to-log-in-to-tfs-automatically.aspx#comments</comments><description>&lt;p&gt;After typing my TFS credentials about a million times, today I finally took the time to figure out how to log on to TFS automatically if the PC that I’m working on is not part of a (or not the same) Active Directory than the TFS server is. Turns out it’s pretty simple: &lt;a href="http://blog.benday.com/archive/2007/10/10/23162.aspx"&gt;http://blog.benday.com/archive/2007/10/10/23162.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Why haven’t I searched for that before?&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=299" width="1" height="1"&gt;</description></item><item><title>Custom Dictionary for Code Analysis</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/04/06/custom-dictionary-for-code-analysis.aspx</link><pubDate>Tue, 06 Apr 2010 13:42:39 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:297</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=297</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/04/06/custom-dictionary-for-code-analysis.aspx#comments</comments><description>&lt;p&gt;At the DevDays 2010 in my session on Building Maintainable Applications, a question came up how to add custom words to Code Analysis. I’ve done that a couple of times, but couldn’t remember it from the top of my had. So, this is just a note-to-self.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Add a XML file (e.g. CustomDictionary.xml) to your project&lt;/li&gt;    &lt;li&gt;Set the Build Action to &lt;strong&gt;CodeAnalysisDictionary&lt;/strong&gt;&lt;/li&gt;    &lt;li&gt;Set Copy to Output Directory to &lt;strong&gt;Do not copy&lt;/strong&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If you put the xml file in the root install folder of Visual Studio, it’ll be applied to all projects. Alternatively, you could share a dictionary file using the Add as Link when adding files to a project.&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=297" width="1" height="1"&gt;</description></item><item><title>Software Quality: External versus Internal</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/04/06/software-quality-external-versus-internal.aspx</link><pubDate>Tue, 06 Apr 2010 10:01:05 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:296</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=296</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/04/06/software-quality-external-versus-internal.aspx#comments</comments><description>&lt;p&gt;I’m doing quite a lot of software quality audits lately. Some customers want to know what the quality is of a product that was developed off-shore. Some just want to know how long they should keep developing the current version or if they should start developing a new version in a new environment. Often products that have been around for long have architectures that are not kept into shape. Or new requirements that just won’t fit into the current architecture. Of requirements that are just too hard to do in the current environment, for example communicating with advanced webservices that require certificates, SSL, custom authentication or reliable sessions. For products developed with for example VB6, this is just extremely time-consuming to develop. While this is plain easy in WCF.&lt;/p&gt;  &lt;p&gt;Anyway, whatever the reason is that customers have to request an quality audit, I always first explain to them the difference between what I call the external and internal quality of a software product.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;External quality      &lt;br /&gt;This is the quality of the product that is perceived by the users of the product. This includes the stability of the product, the ease of use of it, the interaction design and the way it conforms to the requirements &lt;/li&gt;    &lt;li&gt;Internal quality     &lt;br /&gt;This is the quality of the source code, the quality of the architecture, the quality of the development process around the product, etc. Anything that is not perceivable by the users of the software.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;We at &lt;a href="http://www.oosterkamp.nl/Home.mvc/Index" target="_blank"&gt;Oosterkamp training | consultancy&lt;/a&gt; are specialized in auditing the internal quality of software. We have developed our own techniques for quickly and accurately determining the internal quality of software. For example, we look at how &lt;a href="http://www.amazon.co.uk/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882" target="_blank"&gt;clean the code&lt;/a&gt; is. We also inspect software for possible defects in software using &lt;a href="http://www.ifsq.nl/" target="_blank"&gt;IfSQ&lt;/a&gt;. We look at the architecture of the software, the consistency of used solutions, etc., etc.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.oosterkamp.nl/Info.mvc/Contact" target="_blank"&gt;Call us&lt;/a&gt; if you’re interested in an audit or are interested in reviews of audits we did for our customers.&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=296" width="1" height="1"&gt;</description></item><item><title>MVP C# in 2010</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/01/01/mvp-c-in-2010.aspx</link><pubDate>Fri, 01 Jan 2010 21:16:46 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:290</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=290</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2010/01/01/mvp-c-in-2010.aspx#comments</comments><description>&lt;p&gt;I was notified today by email that Microsoft awarded me the 2010 Microsoft MVP Award for C#. &lt;/p&gt;  &lt;p&gt;Just great! &lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=290" width="1" height="1"&gt;</description></item><item><title>MSTest: Cannot start more than one local run</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/12/22/mstest-cannot-start-more-than-one-local-run.aspx</link><pubDate>Tue, 22 Dec 2009 11:44:22 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:287</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=287</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/12/22/mstest-cannot-start-more-than-one-local-run.aspx#comments</comments><description>&lt;p&gt;When I run my tests in Visual Studio and one or more tests fail, I hit the Debug Selected Test so see what is going on. But at times, I get this error message:   &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://blogs.oosterkamp.nl/blogs/thomas/image_7F28321E.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.oosterkamp.nl/blogs/thomas/image_thumb_258A156A.png" width="244" height="133" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I don’t know what trigger this, but I had to restart Visual Studio to be able to Run or Debug tests again. After some searching on the net, I found out that there’s some sort of communication error between Visual Studio and the executable that actually runs the tests. So my resolution now is to kill that process and try again. The name of the executable to look for is VSTestHost.exe. Kill the process and you’re good to go…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.oosterkamp.nl/blogs/thomas/image_3E19B2BA.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.oosterkamp.nl/blogs/thomas/image_thumb_00C8D826.png" width="613" height="605" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=287" width="1" height="1"&gt;</description></item><item><title>Chad Hower’s story</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/12/08/chad-hower-s-story.aspx</link><pubDate>Tue, 08 Dec 2009 11:08:39 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:282</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=282</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/12/08/chad-hower-s-story.aspx#comments</comments><description>&lt;p&gt;A friend of mine, Chad Hower aka Kudzu, is in trouble. Chad has developed many internet-related components for Delphi, with Indy (being shipped with Delphi) being the most well known. Chad is also a speaker and writer and now works for Microsoft. He’s accused of kidnapping his son. Although there’s really strong evidence that it’s totally impossible for him to have done so. For example, how can you kidnap a son you have custody over? It’s a heartbreaking and quite unbelievable story. Watch the 5 minute at &lt;a href="http://www.freechad.org"&gt;www.freechad.org&lt;/a&gt; and spread the word!&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=282" width="1" height="1"&gt;</description></item><item><title>What’s new in WCF 4.0: brief summary</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/11/27/what-s-new-in-wcf-4-0-brief-summary.aspx</link><pubDate>Fri, 27 Nov 2009 10:59:25 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:278</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=278</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/11/27/what-s-new-in-wcf-4-0-brief-summary.aspx#comments</comments><description>&lt;p&gt;Below are the notes I took at the PDC about what’s new in WCF 4.0. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Default bindings can be created. If no bindings are specified for a service, these bindings are used.&lt;/li&gt;    &lt;li&gt;WCf supports configuration inheritance, so bindings could also be specified at various levels including the machine.config.&lt;/li&gt;    &lt;li&gt;Same applies to behaviors&lt;/li&gt;    &lt;li&gt;Default bindings/behaviors are the bindings/behaviors that have no name or name=”” in the configuration&lt;/li&gt;    &lt;li&gt;Configuration based activation allows services without *.svc files&lt;/li&gt;    &lt;li&gt;ETW (Event Tracing for Windows) is used by WCF&lt;/li&gt;    &lt;li&gt;AppFabric (FKA “Dublin”) stores that data in a Sql Server database for easy retrieval and querying. &lt;/li&gt;    &lt;li&gt;Routing is a completely new feature in WCF which allows service aggregation, protocol bridging and versioning.&lt;/li&gt;    &lt;li&gt;MessageFilters are used to determine destination(s).&lt;/li&gt;    &lt;li&gt;Routing table can be changed at runtime.&lt;/li&gt;    &lt;li&gt;Security can also be bridged.&lt;/li&gt;    &lt;li&gt;Alternate endpoints can be specified for fail-over-safety.&lt;/li&gt;    &lt;li&gt;Discovery is another new feature. It allows for location agility, dynamic / self-healing apps&lt;/li&gt;    &lt;li&gt;Discovery adheres to WS-Discovery standards&lt;/li&gt;    &lt;li&gt;Two mode for discovery: Ad-hoc and managed&lt;/li&gt;    &lt;li&gt;Ad-hoc discovery uses broadcasts&lt;/li&gt;    &lt;li&gt;Managed discovery is like UDDI with a Discovery Proxy.&lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=278" width="1" height="1"&gt;</description><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/WCF/default.aspx">WCF</category></item><item><title>Compile-time checked region names in Prism</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/10/30/compile-time-checked-region-names-in-prism.aspx</link><pubDate>Fri, 30 Oct 2009 19:28:25 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:267</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=267</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/10/30/compile-time-checked-region-names-in-prism.aspx#comments</comments><description>&lt;p&gt;In a R&amp;amp;D project of mine, I’m using &lt;a href="http://compositewpf.codeplex.com/" target="_blank"&gt;Prism&lt;/a&gt; to create a composite WPF application. I can recommend anyone writing WPF or Silverlight applications to &lt;a href="http://channel9.msdn.com/shows/Continuum/Prismv2/" target="_blank"&gt;take a look&lt;/a&gt; at it if you’re unfamiliair with Prism.&lt;/p&gt;  &lt;p&gt;One thing I dislike about it though, is that is uses strings as region names. Meaning that there’s no compile-time checking if your region names in the Shell and the names you’re using when registering the views are actually aligned.&lt;/p&gt;  &lt;p&gt;Here’s a small trick to get compile-time checking for your region names in Prism:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Define an Enum containing the names of all known regions:      &lt;br /&gt;      &lt;br /&gt;      &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;       &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;enum&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;RegionName&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ToolBar,&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MessageList,&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Details&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;
    &lt;/div&gt;

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;Define a &lt;a href="http://msdn.microsoft.com/en-us/library/ms747254.aspx" target="_blank"&gt;MarkupExtension&lt;/a&gt; for each value of the enum. This sounds like a lot of work, but with a base class like the one below, it’s no more than a few lines. 

    &lt;br /&gt;

    &lt;br /&gt;

    &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;
      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;BaseRegionExtension&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;MarkupExtension&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;RegionName&lt;/span&gt; _regionName;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; BaseRegionExtension(&lt;span style="color:#2b91af;"&gt;RegionName&lt;/span&gt; regionName)&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _regionName = regionName;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;object&lt;/span&gt; ProvideValue(&lt;span style="color:#2b91af;"&gt;IServiceProvider&lt;/span&gt; serviceProvider)&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;return&lt;/span&gt; _regionName.ToString();&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;RegionName&lt;/span&gt; Name&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;get&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;return&lt;/span&gt; _regionName;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;set&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; _regionName = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;
    &lt;/div&gt;

    &lt;br /&gt;

    &lt;br /&gt;Defining a MarkupExtension now becomes really simple: 

    &lt;br /&gt;

    &lt;br /&gt;

    &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;
      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ToolBarRegionExtension&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;BaseRegionExtension&lt;/span&gt;&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color:blue;"&gt;public&lt;/span&gt; ToolBarRegionExtension()&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : &lt;span style="color:blue;"&gt;base&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;RegionName&lt;/span&gt;.ToolBar)&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;

      &lt;pre style="margin:0px;"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/pre&gt;
    &lt;/div&gt;

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;When registering your view, just call the ToString() of the enum value you want to use: 
    &lt;br /&gt;

    &lt;br /&gt;

    &lt;div style="font-family:consolas;background:white;color:black;font-size:10pt;"&gt;
      &lt;pre style="margin:0px;"&gt;&amp;#160; _regionManager.RegisterViewWithRegion(&lt;span style="color:#2b91af;"&gt;RegionName&lt;/span&gt;.ToolBar.ToString(), &lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;MainToolbarView&lt;/span&gt;));&lt;/pre&gt;
    &lt;/div&gt;

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;When defining regions in your Shell Xaml file, use the right MarkupExtension to reference a value in your enum: 
    &lt;br /&gt;

    &lt;br /&gt;&amp;lt;ToolBarPanel&amp;gt;

    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;ItemsControl cal:RegionManager.RegionName=&amp;quot;{ui:ToolBarRegion}&amp;quot;&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/ItemsControl&amp;gt;

    &lt;br /&gt; &amp;lt;/ToolBarPanel&amp;gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Have fun!&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=267" width="1" height="1"&gt;</description><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>No regions when generating code</title><link>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/10/21/no-regions-when-generating-code.aspx</link><pubDate>Wed, 21 Oct 2009 17:58:14 GMT</pubDate><guid isPermaLink="false">6da500ce-fa22-46ef-b417-4864733669f6:260</guid><dc:creator>Thomas</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.oosterkamp.nl/blogs/thomas/rsscomments.aspx?PostID=260</wfw:commentRss><comments>http://blogs.oosterkamp.nl/blogs/thomas/archive/2009/10/21/no-regions-when-generating-code.aspx#comments</comments><description>&lt;p&gt;Just wished I had found this option about 5 years earlier….&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.oosterkamp.nl/blogs/thomas/image_0E092ADA.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.oosterkamp.nl/blogs/thomas/image_thumb_4496D61E.png" width="751" height="434" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.oosterkamp.nl/aggbug.aspx?PostID=260" width="1" height="1"&gt;</description><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.oosterkamp.nl/blogs/thomas/archive/tags/Trick/default.aspx">Trick</category></item></channel></rss>
