<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Alkampfer's Place</title>
	
	<link>http://www.codewrecks.com/blog</link>
	<description>Wrecks of code floating in the sea of Internet</description>
	<lastBuildDate>Tue, 27 Jul 2010 10:16:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AlkampferEng" /><feedburner:info uri="alkampfereng" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>43.44754459758882</geo:lat><geo:long>12.84752368927002</geo:long><image><url>http://www.feedburner.com/fb/images/pub/fb_pwrd.gif</url></image><feedburner:emailServiceId>AlkampferEng</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Codeplex is upgraded–how to map to the new server</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/jZP_W4M7i6w/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/27/codeplex-is-upgradedhow-to-map-to-the-new-server/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 10:16:27 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Codeplex]]></category>
		<category><![CDATA[Tfs]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/27/codeplex-is-upgradedhow-to-map-to-the-new-server/</guid>
		<description><![CDATA[
			
				
			
		
My frient Guardian blogged some minutes ago explaining how you can change the mapping of your codeplex project now that codeplex is migrated to TFS2010. There is even a simpler solution, first of all open Visual Studio, then connect to the new tfs server. As you can see in Figure 1 I have projects in [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F27%2Fcodeplex-is-upgradedhow-to-map-to-the-new-server%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F27%2Fcodeplex-is-upgradedhow-to-map-to-the-new-server%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>My frient Guardian <a target="_blank" href="http://www.primordialcode.com/blog/post/update-tfs-workspace-codeplex-upgrade-tfs2010">blogged</a> some minutes ago explaining how you can change the mapping of your codeplex project now that codeplex is migrated to TFS2010. There is even a simpler solution, first of all open Visual Studio, then connect to the new tfs server. As you can see in <strong>Figure 1</strong> I have projects in three project collection, I select to connect to the TFS08 project collection where I’m contributor to two project</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image19.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb19.png" width="652" height="215" /></a></p>
<p><strong>Figure 1:</strong><em> Connect to the new codeplex address</em></p>
<p>Now, after you are connected to the right project collection, simply open the code from the local workspace that still maps to the old server, and Visual Studio should upgrade everything automatically. To verify if everything is ok, go to menu: <em>File –&gt; Source Control –&gt; Workspaces</em> and verify the server mapped in the workspace as in <strong>Figure 2</strong>.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image20.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb20.png" width="714" height="254" /></a></p>
<p><strong>Figure 2: </strong><em>The workspace has automatically changed server and now points to the right one.</em></p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/6qNGJvCBxdE7vCznVtKk_97OzmY/0/da"><img src="http://feedads.g.doubleclick.net/~a/6qNGJvCBxdE7vCznVtKk_97OzmY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/6qNGJvCBxdE7vCznVtKk_97OzmY/1/da"><img src="http://feedads.g.doubleclick.net/~a/6qNGJvCBxdE7vCznVtKk_97OzmY/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=jZP_W4M7i6w:qnM03gv4-Mo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=jZP_W4M7i6w:qnM03gv4-Mo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=jZP_W4M7i6w:qnM03gv4-Mo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=jZP_W4M7i6w:qnM03gv4-Mo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=jZP_W4M7i6w:qnM03gv4-Mo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=jZP_W4M7i6w:qnM03gv4-Mo:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/jZP_W4M7i6w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/27/codeplex-is-upgradedhow-to-map-to-the-new-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/27/codeplex-is-upgradedhow-to-map-to-the-new-server/</feedburner:origLink></item>
		<item>
		<title>Primitive broker class</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/7I_Lt29dzUk/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/26/primitive-broker-class/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 15:51:55 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Experiences]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/26/primitive-broker-class/</guid>
		<description><![CDATA[
			
				
			
		
I need in a simple project the ability to communicate various type of messages through different View Model in a WPF application, some VM raise some message about something that is happened in the system, and other VM can listen for messages and doing something with them. 
I know that there are a lot of [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F26%2Fprimitive-broker-class%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F26%2Fprimitive-broker-class%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I need in a simple project the ability to communicate various type of messages through different View Model in a WPF application, some VM raise some message about something that is happened in the system, and other VM can listen for messages and doing something with them. </p>
<p>I know that there are a lot of framework out of there, but sometimes you need a quick implementation that you can share with the team, without the need to tell to others “Hey you need to master xxx framework for understanding what is happening”. The result is a really 30 minutes implementation of a primitive broker. I want a central component where every View Model can register/unregister for a specific kind of a message, and send messages.</p>
<p>I decided to discriminate messages based on the type of data contained in the message, the message itself is a simple class with a message string and a payload.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image17.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb17.png" width="186" height="210" /></a></p>
<p>View Models register for a specific kind of payload, as an example I want to be able of issue this code to register whenever someone send a message with a&#160; payload of type List&lt;ActionLogViewModel&gt;.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> broker.RegisterForMessage&lt;List&lt;ActionLogViewModel&gt;&gt;(ReceiveLog);</pre>
<p><!--CRLF--></div>
</div>
<p>The result is this really simple class, that is based on delegate</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image18.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb18.png" width="294" height="249" /></a></p>
<p>It maintains internally a dictionary of registered action based on type of the payload</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">private</span> Dictionary&lt;Type, List&lt;Object&gt;&gt; _registeredActions = </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     <span style="color: #0000ff">new</span> Dictionary&lt;Type, List&lt;Object&gt;&gt;();</pre>
<p><!--CRLF--></div>
</div>
<p>The RegisterForMessage&lt;T&gt; is really simple, because I simply need to save an Action&lt;Message&lt;T&gt;&gt; into the dictionary.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> RegisterForMessage&lt;T&gt;(Action&lt;Message&lt;T&gt;&gt; action)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     List&lt;Object&gt; actions;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">if</span> (!_registeredActions.ContainsKey(<span style="color: #0000ff">typeof</span>(T)))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         actions = <span style="color: #0000ff">new</span> List&lt;Object&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         _registeredActions.Add(<span style="color: #0000ff">typeof</span>(T), actions);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         actions = _registeredActions[<span style="color: #0000ff">typeof</span>(T)];</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     actions.Add(action);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> }</pre>
<p><!--CRLF--></div>
</p></div>
</p>
<p>The send message is a very simple function too because it look for registered action in the internal dictionary, and executes them one after the other. </p>
<p>I know that this is really a too simple implementation for a serious brocker system, but for a&#160; simple program, where my only need is to dispatch some messages between windows, it is enough. The main advantage of this approach, is that it is really simple to understand, and I can avoid to force other members of the team to learn new framework.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/HPL_jyiPagTL-z5VkilLauRu5Mk/0/da"><img src="http://feedads.g.doubleclick.net/~a/HPL_jyiPagTL-z5VkilLauRu5Mk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HPL_jyiPagTL-z5VkilLauRu5Mk/1/da"><img src="http://feedads.g.doubleclick.net/~a/HPL_jyiPagTL-z5VkilLauRu5Mk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=7I_Lt29dzUk:grQPNGpRGBw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=7I_Lt29dzUk:grQPNGpRGBw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=7I_Lt29dzUk:grQPNGpRGBw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=7I_Lt29dzUk:grQPNGpRGBw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=7I_Lt29dzUk:grQPNGpRGBw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=7I_Lt29dzUk:grQPNGpRGBw:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/7I_Lt29dzUk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/26/primitive-broker-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/26/primitive-broker-class/</feedburner:origLink></item>
		<item>
		<title>Bind an Image to a property in WPF</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/Vjbo2Z6rhxY/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/23/bind-an-image-to-a-property-in-wpf/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 12:23:59 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/23/bind-an-image-to-a-property-in-wpf/</guid>
		<description><![CDATA[
			
				
			
		
The situation is the following: I have a class that has a Status property of type SingleAnalysisStatus enum, and I want to show a different png image, based on the status of the object.
The solution is to write a custom IValueConverter that convert from the enum to a valid resource file, but we need to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F23%2Fbind-an-image-to-a-property-in-wpf%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F23%2Fbind-an-image-to-a-property-in-wpf%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>The situation is the following: I have a class that has a Status property of type SingleAnalysisStatus enum, and I want to show a different png image, based on the status of the object.</p>
<p>The solution is to write a custom <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx">IValueConverter</a> that convert from the enum to a valid resource file, but we need to pay specific attention. In WPF you can include images as resources in a very simple way, just include the images in the project and set the “build Action” to Resource, as shown in <strong>Figure 1</strong>.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb8.png" width="521" height="304" /></a></p>
<p><strong>Figure 1:</strong><em> include an image file as resource in a WPF application</em></p>
<p>In this way you can simply use this syntax to assign a resource image to an object of type Image</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Image</span> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     <span style="color: #ff0000">HorizontalAlignment</span><span style="color: #0000ff">=&quot;Left&quot;</span> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #ff0000">Height</span><span style="color: #0000ff">=&quot;100&quot;</span> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #ff0000">Width</span><span style="color: #0000ff">=&quot;100&quot;</span> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     <span style="color: #ff0000">Source</span><span style="color: #0000ff">=&quot;/Images/NotMatch.png&quot;</span><span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>You can simply specify the path of the image in the Source property of an Image Element, but to show a different image depending on the value of an enum requires a specific ValueConverter, and you need to be aware that this converter need to convert from the original type to a BitmapImage object, because the Source property of an &lt;image&gt; will not accepts string during binding. Here is how you can accomplish this.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Window.Resources</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">Converter:SingleAnalysisStatusConverter</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;statusconverter&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>    <span style="color: #0000ff">&lt;</span><span style="color: #800000">DataTemplate</span> <span style="color: #ff0000">x:Key</span><span style="color: #0000ff">=&quot;ItemTemplate&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>      <span style="color: #0000ff">&lt;</span><span style="color: #800000">DockPanel</span><span style="color: #0000ff">&gt;</span> </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">Image</span> <span style="color: #ff0000">HorizontalAlignment</span><span style="color: #0000ff">=&quot;Right&quot;</span> <span style="color: #ff0000">Height</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #ff0000">Margin</span><span style="color: #0000ff">=&quot;0&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>                       <span style="color: #ff0000">Source</span><span style="color: #0000ff">=&quot;{Binding Status, Converter={StaticResource statusconverter}}&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>                       <span style="color: #ff0000">VerticalAlignment</span><span style="color: #0000ff">=&quot;Bottom&quot;</span> <span style="color: #ff0000">Width</span><span style="color: #0000ff">=&quot;24&quot;</span> <span style="color: #ff0000">Stretch</span><span style="color: #0000ff">=&quot;Fill&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></div>
</p></div>
</p>
<p>In this snippet of code I’m showing how to bind the Source property of an Image to the Status property of the underling ViewModel, and thanks to the SingleAnalysisStatusConverter object I’m able to convert the status to a valid <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.aspx">BitmapImage</a> object. This is the full code of the IValueConverter object.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">class</span> SingleAnalysisStatusConverter: IValueConverter </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #cc6633">#region</span> IValueConverter Members</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">object</span> Convert(<span style="color: #0000ff">object</span> <span style="color: #0000ff">value</span>, Type targetType, <span style="color: #0000ff">object</span> parameter, System.Globalization.CultureInfo culture)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>         <span style="color: #0000ff">if</span> (!(<span style="color: #0000ff">value</span> <span style="color: #0000ff">is</span> SingleAnalysisStatus))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>             <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotImplementedException(<span style="color: #006080">&quot;SingleAnalysisStatusConverter can only convert from SingleAnalysisStatus&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         String path = <span style="color: #0000ff">null</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">switch</span> ((SingleAnalysisStatus ) <span style="color: #0000ff">value</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>                 <span style="color: #0000ff">case</span> SingleAnalysisStatus.NotAnalyzed:</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>                     path = <span style="color: #006080">&quot;Images/NotAnalyzed.png&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>                     <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>                 <span style="color: #0000ff">case</span> SingleAnalysisStatus.DuringAnalysis:</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>                     path = <span style="color: #006080">&quot;Images/DuringAnalysis.png&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>                     <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>                 <span style="color: #0000ff">case</span> SingleAnalysisStatus.Match:</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>                     path = <span style="color: #006080">&quot;Images/Match.png&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>                     <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>                 <span style="color: #0000ff">case</span> SingleAnalysisStatus.NotMatch:</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>                     path = <span style="color: #006080">&quot;Images/NotMatch.png&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>                     <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>                 <span style="color: #0000ff">case</span> SingleAnalysisStatus.ErrorDownload:</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>                     path = <span style="color: #006080">&quot;Images/DownloadError.png&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>                     <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>             <span style="color: #0000ff">default</span> :</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>                     <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotSupportedException();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>         <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> BitmapImage(<span style="color: #0000ff">new</span> Uri(<span style="color: #006080">&quot;/AssemblyName;component/&quot;</span> + path, UriKind.Relative));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">object</span> ConvertBack(<span style="color: #0000ff">object</span> <span style="color: #0000ff">value</span>, Type targetType, <span style="color: #0000ff">object</span> parameter, System.Globalization.CultureInfo culture)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>         <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> NotImplementedException();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span>     <span style="color: #cc6633">#endregion</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span> }</pre>
<p><!--CRLF--></div>
</p></div>
</p>
<p>The key part is the line</p>
<p><em>return new BitmapImage(new Uri(&quot;/AssemblyName;component/&quot; + path, UriKind.Relative));</em></p>
<p>that creates the BitmapImage passing an uri composed by the: assemblyname + semicolon + component/ + imagepath. With this simple converter I’m able to show different images based on content of a specific property. </p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/-ijb6ubT_7y3Sh2u0psTLAruAXU/0/da"><img src="http://feedads.g.doubleclick.net/~a/-ijb6ubT_7y3Sh2u0psTLAruAXU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-ijb6ubT_7y3Sh2u0psTLAruAXU/1/da"><img src="http://feedads.g.doubleclick.net/~a/-ijb6ubT_7y3Sh2u0psTLAruAXU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Vjbo2Z6rhxY:SVHh4qTEo94:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Vjbo2Z6rhxY:SVHh4qTEo94:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Vjbo2Z6rhxY:SVHh4qTEo94:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=Vjbo2Z6rhxY:SVHh4qTEo94:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Vjbo2Z6rhxY:SVHh4qTEo94:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Vjbo2Z6rhxY:SVHh4qTEo94:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/Vjbo2Z6rhxY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/23/bind-an-image-to-a-property-in-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/23/bind-an-image-to-a-property-in-wpf/</feedburner:origLink></item>
		<item>
		<title>Productivity power tools, navigation</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/TS5m-Fd3PX8/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/22/productivity-power-tools-navigation/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 12:38:02 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Visual Studio Team System]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/22/productivity-power-tools-navigation/</guid>
		<description><![CDATA[
			
				
			
		
With Visual Studio 2010 we are expecting a great number on new adding, made possible from the new extension point offered by MEF, and in general with the migration of part of the interface to WPF. One of the most exiting addin is the Productivity Power Tool released by Microsoft. It has a great number [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F22%2Fproductivity-power-tools-navigation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F22%2Fproductivity-power-tools-navigation%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>With Visual Studio 2010 we are expecting a great number on new adding, made possible from the new extension point offered by MEF, and in general with the migration of part of the interface to WPF. One of the most exiting addin is the <a target="_blank" href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef">Productivity Power Tool</a> released by Microsoft. It has a great number of features, but one of the most useful is the ability to browse code in a really advanced way. If you simply hover over a class name or a variable a tooltip appears, as showed in <strong>Figure 1</strong></p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb5.png" width="466" height="104" /></a></p>
<p><strong>Figure 1:</strong><em> hover on a class name or variable and a tooltip will appear.</em></p>
<p>Clicking on the tooltip will open a nice toolbar that shows a lot about the class, as visible in Figure 2.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb6.png" width="496" height="364" /></a></p>
<p><strong>Figure 2: </strong><em>you can browse a lot of information about the class.</em></p>
<p>Surely one of the most useful information is given by the <em>reference</em> tab as shown in <strong>Figure 3</strong>.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb7.png" width="689" height="353" /></a></p>
<p><strong>Figure 3: </strong><em>all references of a given type is shown in the windows</em></p>
<p>As you can see, you can immediately visualize every point in code where the class is used. This kind of Smart Browsing of code, is clearly avaliable even for method or properties, and permits you to quickly identify how a specific part of the code is used. And this is only one of the many features of this tool, so go and download it.</p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/u6YcGcrIaszVdZmnNyfUn-TV-nQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/u6YcGcrIaszVdZmnNyfUn-TV-nQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/u6YcGcrIaszVdZmnNyfUn-TV-nQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/u6YcGcrIaszVdZmnNyfUn-TV-nQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=TS5m-Fd3PX8:FTAVs51MW4I:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=TS5m-Fd3PX8:FTAVs51MW4I:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=TS5m-Fd3PX8:FTAVs51MW4I:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=TS5m-Fd3PX8:FTAVs51MW4I:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=TS5m-Fd3PX8:FTAVs51MW4I:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=TS5m-Fd3PX8:FTAVs51MW4I:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/TS5m-Fd3PX8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/22/productivity-power-tools-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/22/productivity-power-tools-navigation/</feedburner:origLink></item>
		<item>
		<title>Microsoft Scrum 1.0 released</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/9hhwK4_b4Qw/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/20/microsoft-scrum-1-0-released/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 07:09:13 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/20/microsoft-scrum-1-0-released/</guid>
		<description><![CDATA[
			
				
			
		
Microsoft have just released the 1.0 version of the scrum template for TFS. The reason behind this, is that a lot of person wish a template that closely match the scrum process, as described in the literature.
With this template we now have two agile process template, the first is the classic MSF Agile 5.0, that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F20%2Fmicrosoft-scrum-1-0-released%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F20%2Fmicrosoft-scrum-1-0-released%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Microsoft have just released the 1.0 version of the <a target="_blank" href="http://blogs.msdn.com/b/aaronbjork/archive/2010/07/19/announcing-microsoft-visual-studio-scrum-1-0.aspx">scrum template for TFS</a>. The reason behind this, is that a lot of person wish a template that closely match the scrum process, as described in the literature.</p>
<p>With this template we now have two agile process template, the first is the classic MSF Agile 5.0, that is based on scrum, but is more generic and is not strictly based on a Scrum process, and the new Scrum template to satisfy those one that want to implement a full feature Scrum process.</p>
<p>Go and take a look at it. </p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/GSQPq0pdcqin8QRT-0TYKxhGaVU/0/da"><img src="http://feedads.g.doubleclick.net/~a/GSQPq0pdcqin8QRT-0TYKxhGaVU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/GSQPq0pdcqin8QRT-0TYKxhGaVU/1/da"><img src="http://feedads.g.doubleclick.net/~a/GSQPq0pdcqin8QRT-0TYKxhGaVU/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=9hhwK4_b4Qw:IFvHi8moR8E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=9hhwK4_b4Qw:IFvHi8moR8E:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=9hhwK4_b4Qw:IFvHi8moR8E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=9hhwK4_b4Qw:IFvHi8moR8E:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=9hhwK4_b4Qw:IFvHi8moR8E:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=9hhwK4_b4Qw:IFvHi8moR8E:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/9hhwK4_b4Qw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/20/microsoft-scrum-1-0-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/20/microsoft-scrum-1-0-released/</feedburner:origLink></item>
		<item>
		<title>Team Explorer Everywhere–first impression</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/BJYD5kJmoG8/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/14/team-explorer-everywherefirst-impression/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 16:38:00 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Team Explorere Everywhere]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/14/team-explorer-everywherefirst-impression/</guid>
		<description><![CDATA[
			
				
			
		
One of the coolest news of TFS 2010 is the presence of Team Explorer Everywhere, a plugin for eclipse and a command line cross platform tool to access TFS. I do not work with Java, but I want to have a look at it, just to understand the level of integration with TFs. 
First impression [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F14%2Fteam-explorer-everywherefirst-impression%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F14%2Fteam-explorer-everywherefirst-impression%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the coolest news of TFS 2010 is the presence of Team Explorer Everywhere, a plugin for eclipse and a command line cross platform tool to access TFS. I do not work with Java, but I want to have a look at it, just to understand the level of integration with TFs. </p>
<p>First impression is really good, because the look and feel of the IDE is really similar to those of Visual Studio, as you can spot from <strong>Figure 1</strong>, where I show the connection windows to a local tfs.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image14.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb14.png" width="709" height="368" /></a></p>
<p><strong>Figure 1:</strong> <em>Connect to a Tfs Server from Eclipse</em></p>
<p>After you connect to the Tfs, you can see the very familiar windows where I can choose project collection and team project I want to connect to, again in <strong>Figure 2</strong> you can see that the look and feel is really similar to those one of Visual Studio.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image15.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb15.png" width="515" height="412" /></a></p>
<p><strong>Figure 2:</strong><em> Choose the list of team project you want to connect to.</em></p>
<p><em></em>Now the system suggest you to create a workspace, and you can immediately edit and map it to some source folder as you can see in <strong>Figure 3</strong>.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb4.png" width="695" height="505" /></a></p>
<p><strong>Figure 3: </strong><em>Create a workspace and map source to a local folder.</em></p>
<p>Now you can use eclipse like Team Explorer, it is quite identical, look at <strong>Figure 4</strong> to see the Source Control windows that permits you to browse into the source code, it is really fast.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image16.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb16.png" width="678" height="398" /></a></p>
<p><strong>Figure 4:</strong> <em>Source control windows to browse files into the repository</em></p>
<p>First impression is really good, I’m able to do query against Work Item, defining and editing builds, creating query etc etc. The Work Item viewer has all the functions of Team Explorer, and you can edit the query, choose column to view etc etc, as visible in <strong>Figure 5</strong>.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/2342342342.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="2342342342" border="0" alt="2342342342" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/2342342342_thumb.png" width="744" height="384" /></a></p>
<p><strong>Figure 5: </strong><em>Work Item view, buttons to manage WI and Hierarchical View </em></p>
<p>The first impression on Team Explorer Everywhere, from the point of view of a developer that never worked seriously on eclipse is really good, because it has all the feature that TE has in Visual Studio. </p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/KlRuzvdoauEW_9QU1je1CGIFvH4/0/da"><img src="http://feedads.g.doubleclick.net/~a/KlRuzvdoauEW_9QU1je1CGIFvH4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KlRuzvdoauEW_9QU1je1CGIFvH4/1/da"><img src="http://feedads.g.doubleclick.net/~a/KlRuzvdoauEW_9QU1je1CGIFvH4/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=BJYD5kJmoG8:swwyhonTgXc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=BJYD5kJmoG8:swwyhonTgXc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=BJYD5kJmoG8:swwyhonTgXc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=BJYD5kJmoG8:swwyhonTgXc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=BJYD5kJmoG8:swwyhonTgXc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=BJYD5kJmoG8:swwyhonTgXc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/BJYD5kJmoG8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/14/team-explorer-everywherefirst-impression/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/14/team-explorer-everywherefirst-impression/</feedburner:origLink></item>
		<item>
		<title>Error during clickonce deploy with mshtml – Strong name signature not valid for this assembly</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/q1rtWMWGXJk/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/13/error-during-clickonce-deploy-with-mshtml-strong-name-signature-not-valid-for-this-assembly/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 08:47:19 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[.NET framework]]></category>
		<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/13/error-during-clickonce-deploy-with-mshtml-strong-name-signature-not-valid-for-this-assembly/</guid>
		<description><![CDATA[
			
				
			
		
To deploy application that use mshtml with clickonce, you need to be sure that microsoft.mshtml.dll is included in the setup of click once, or the application will not install if mshtml.dll is not present on the machine at the time of deploy. But if you include it sometimes clients are not able to install application [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F13%2Ferror-during-clickonce-deploy-with-mshtml-strong-name-signature-not-valid-for-this-assembly%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F13%2Ferror-during-clickonce-deploy-with-mshtml-strong-name-signature-not-valid-for-this-assembly%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>To deploy application that use mshtml with clickonce, you need to be sure that microsoft.mshtml.dll is included in the setup of click once, or the application will not install if mshtml.dll is not present on the machine at the time of deploy. But if you include it sometimes clients are not able to install application due to the following error</p>
<p><em>Strong name signature not valid for this assembly Microsoft.mshtml.dll</em></p>
<p>this is due to the fact that you reference a partially signed version in your project. To solve this remove the reference to mshtml.dll and reference the dll in </p>
<p><em>C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll</em></p>
<p>Remove the (x86) if you are on a 32 bit system. Now with the reference to this assembly be sure that is included in the clickonce application files and everything should now work.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Hn0DtOgiEEp3OUR2O5ZZDs6glV4/0/da"><img src="http://feedads.g.doubleclick.net/~a/Hn0DtOgiEEp3OUR2O5ZZDs6glV4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Hn0DtOgiEEp3OUR2O5ZZDs6glV4/1/da"><img src="http://feedads.g.doubleclick.net/~a/Hn0DtOgiEEp3OUR2O5ZZDs6glV4/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=q1rtWMWGXJk:t04T541D3OU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=q1rtWMWGXJk:t04T541D3OU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=q1rtWMWGXJk:t04T541D3OU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=q1rtWMWGXJk:t04T541D3OU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=q1rtWMWGXJk:t04T541D3OU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=q1rtWMWGXJk:t04T541D3OU:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/q1rtWMWGXJk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/13/error-during-clickonce-deploy-with-mshtml-strong-name-signature-not-valid-for-this-assembly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/13/error-during-clickonce-deploy-with-mshtml-strong-name-signature-not-valid-for-this-assembly/</feedburner:origLink></item>
		<item>
		<title>Deploy remotely with TFS build</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/RjTM_2uxJvY/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/10/deploy-remotely-with-tfs-build/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 06:29:11 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[TFS Build]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/10/deploy-remotely-with-tfs-build/</guid>
		<description><![CDATA[
			
				
			
		
It is time to connect together a couple of posts of mine, in the first I simply explained how to deploy a web application to a remote machine with the use of Beyondexec2, in another one I explained how to create a simple tfs build, that actually does not build anything, but execute a simple [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F10%2Fdeploy-remotely-with-tfs-build%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F10%2Fdeploy-remotely-with-tfs-build%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>It is time to connect together a couple of posts of mine, <a href="http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/">in the first</a> I simply explained how to deploy a web application to a remote machine with the use of Beyondexec2, <a href="http://www.codewrecks.com/blog/index.php/2010/07/07/use-tfs-2010-build-to-execute-arbitrary-task/">in another one</a> I explained how to create a simple tfs build, that actually does not build anything, but execute a simple workflow.</p>
<p>In this post I’ll cover a primitive build workflow to deploy the result of another build. The starting point is having a build called “Demo” that builds a web site and create the installer package, plus the script described <a target="_blank" href="http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/">here</a>. You need to insert the scripts and the PsExec utility in the source code of your team project, to be available from the build agent during the build, as shown in <strong>Figure 1</strong>. Note: in this example I’ll use the <a href="http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx">PsExec</a> tools instead of beyondexecv2, but they are exactly equivalent, PsExex is more maintained tool and works better when execute in services.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb2.png" width="547" height="281" /></a></p>
<p> <strong>Figure 1:</strong> <em>Include deploy related files into source control system    <br /></em>
<p>Now you need to modify the deploy script created in the other blog post, adding all the operations needed to deploy a build, first of all you need to define some more parameters (<strong>Figure 2</strong>). These one are the number of the build to use (Es. demo_20100607.3) machine name where you want to install and the password of the administrator account of that machine.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb11.png" width="581" height="142" /></a></p>
<p><strong>Figure 2:</strong> <em>Parameters of the workflow</em></p>
<p>Now, since the tools and script to do remote deploy are stored in source control system, the build scripts needs to create a workspace and do a getlatest; to do this, you can reuse the relative section of the standard workflow showed in <strong>Figure 3</strong>.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled21.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="Untitled2" border="0" alt="Untitled2" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled2_thumb1.png" width="702" height="689" /></a></p>
<p><strong>Figure 3:</strong> <em>Details of workspace management </em></p>
<p>The steps from <strong>Figure 3</strong> is taken from the standard workflow, and it is a common sequence of operation to create a workspace and do a getlatest plus managing some variables. If you run this workflow, as is, you can verify that in the build machine a new workspace is created, and you can browse to the build directory (usually c:\builds\1\teamprojectname\etcetc) to see downloaded files. But before doing this, you need to specify folder to grab in the workspace section of build configuration. As you can see in<strong> Figure 4</strong>, I simply need to grab the BuildTools subdirectory, because there is no need to do a get latest of project sources, but only of the deploy scripts.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image12.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb12.png" width="455" height="137" /></a></p>
<p><strong>Figure 4:</strong> <em>Configuration of the workspace</em>    <br />Now I need only to execute the PsExec process to do a remote execution of the script in the machine where I want my web application to be deployed, and this can be done thanks to a simple Invoke Process Activity, as shown in <strong>Figure 5</strong>.    <br /><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb3.png" width="573" height="422" /></a></p>
<p><strong>Figure 5:</strong> <em>Invoke Process activity permits execution of an external process.</em></p>
<p>FileName property specify the process to execute, for this example is </p>
<p><em><font size="2" face="Courier New">SourcesDirectory + &quot;\psexec.exe&quot;</font></em></p>
<p>Since SourcesDirectory is the one used to map the workspace, I can execute the psexec directly from there. The other important property is the Arguments one:</p>
<p><em>&quot;\\&quot; + DeployMachine +&#160; &quot; -u &quot; + DeployMachine + &quot;\administrator -p &quot; + DeployMachinePassword +     <br />&quot; /accepteula -i -f -h -c &quot; + SourcesDirectory + &quot;\deploy\Deployweb.bat &quot; + BuildToUse</em></p>
<p>This is only a combination of Workflow Parameters to create the argument list, the /accepteula parameter is needed because the psexec shows an eula that should be accepted, and clearly there is noone to click on accept when executed on a service <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/wlEmoticonsmile1.png" />, then the option –c force a file to be copied to remote computer and executed. After the Invoke process, in <strong>Figure 6</strong> I showed the end of the workflow, with a condition that verifies if the PsExec return value is zero (success) or greater than zero (error).</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitledw.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitledw" border="0" alt="Untitledw" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitledw_thumb.png" width="497" height="339" /></a></p>
<p><strong>Figure 6:</strong> <em>Check return value of PsExec and fail the build if greater than zero.</em></p>
<p>The SetBuildProperties activity permits to set a property of the build, in this situation I set the status as Failed. Now you can configure a build, configure parameters and see the result. </p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image13.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb13.png" width="566" height="484" /></a></p>
<p><strong>Figure 7:</strong> <em>Log of a successful build.</em></p>
<p>The only drawback is that you only see output of the psexec program and does not see the output of the execution of DeployWeb.Bat on remote machine. Since you can specify, machine and build number to use, this is a good build script to deploy something on remote machine with a simple click.</p>
<p>alk.</p>
<p>P.S. this is the first post following Adam Cogan’s SSW Rules (thanks Adam, you rock)</p>
<p>- the balloon rule, instead of walls of text</p>
<p><a target="_blank" href="http://sharepoint.ssw.com.au/Standards/Communication/RulesToBetterEmail/Pages/HowToUseBalloons.aspx">http://sharepoint.ssw.com.au/Standards/Communication/RulesToBetterEmail/Pages/HowToUseBalloons.aspx</a></p>
<p>- the figure/caption rule</p>
<p><a target="_blank" href="http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterWebsitesLayout.aspx#AlwaysAddFiguretoImages">http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterWebsitesLayout.aspx#AlwaysAddFiguretoImages</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/f9dGph095Vct4Lay1zMBnOLsQxo/0/da"><img src="http://feedads.g.doubleclick.net/~a/f9dGph095Vct4Lay1zMBnOLsQxo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/f9dGph095Vct4Lay1zMBnOLsQxo/1/da"><img src="http://feedads.g.doubleclick.net/~a/f9dGph095Vct4Lay1zMBnOLsQxo/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=RjTM_2uxJvY:3S6BTRNF8Vg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=RjTM_2uxJvY:3S6BTRNF8Vg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=RjTM_2uxJvY:3S6BTRNF8Vg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=RjTM_2uxJvY:3S6BTRNF8Vg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=RjTM_2uxJvY:3S6BTRNF8Vg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=RjTM_2uxJvY:3S6BTRNF8Vg:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/RjTM_2uxJvY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/10/deploy-remotely-with-tfs-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/10/deploy-remotely-with-tfs-build/</feedburner:origLink></item>
		<item>
		<title>Cache layer</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/fqO76URCijg/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/07/cache-layer/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 12:47:00 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[Aop]]></category>
		<category><![CDATA[Architecture Castle]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/07/cache-layer/</guid>
		<description><![CDATA[
			
				
			
		
Thanks to AOP concept, creating a cache layer that is transparent to the caller is not a big deal. I have a piece of code that in a loop calls this method


   1: ClientCompetitor competitor = Repository.ClientCompetitor.GetByCriteria(

   2:     Query.CreateEq(&#34;AssociatedClient&#34;, clieid))

   3: .SingleOrDefault();

   4: [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F07%2Fcache-layer%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F07%2Fcache-layer%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Thanks to AOP concept, creating a cache layer that is transparent to the caller is not a big deal. I have a piece of code that in a loop calls this method</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> ClientCompetitor competitor = Repository.ClientCompetitor.GetByCriteria(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     Query.CreateEq(<span style="color: #006080">&quot;AssociatedClient&quot;</span>, clieid))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> .SingleOrDefault();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>            </pre>
<p><!--CRLF--></div>
</div>
<p>This is based on a standard implementation of repository and a <a target="_blank" href="http://en.wikipedia.org/wiki/Specification_pattern">Specification Pattern</a> as a query model. With <a target="_blank" href="http://nhprof.com/">nhibernate profiler</a> I see that during the execution of this task, a lot of identical query are issued, because it gets called around 1000 times always with the same clieid.</p>
<p>Now before changing the code of the class to store in a dictionary&lt;ClieId, ClientCompetitor&gt; cached result, I like to handle this with a transparent cache layer used with AOP. This could be achieved registering this interceptor.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">component</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>         <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;RepositoryCache&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>         <span style="color: #ff0000">service</span><span style="color: #0000ff">=&quot;Castle.Core.Interceptor.IInterceptor, Castle.Core&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>         <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;xxx.BaseServices.Castle.Cache2Interceptor, xxx.BaseServices&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         <span style="color: #ff0000">lifestyle</span><span style="color: #0000ff">=&quot;transient&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">parameters</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">invocationCache</span><span style="color: #0000ff">&gt;</span>${WindowsCache}<span style="color: #0000ff">&lt;/</span><span style="color: #800000">invocationCache</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">Rules</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>             <span style="color: #0000ff">&lt;</span><span style="color: #800000">dictionary</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>                 <span style="color: #0000ff">&lt;</span><span style="color: #800000">entry</span> <span style="color: #ff0000">key</span><span style="color: #0000ff">=&quot;ClientCompetitor.*GetByCriteria&quot;</span><span style="color: #0000ff">&gt;</span>.classname(ClientCompetitor) .absolute(600)<span style="color: #0000ff">&lt;/</span><span style="color: #800000">entry</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>             <span style="color: #0000ff">&lt;/</span><span style="color: #800000">dictionary</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Rules</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">parameters</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">component</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>I simply create a Cache2Interceptor object that has a property called Rules to define regular expression to specify witch methods I want to apply cache to. With this configuration I ask to put cache in ClientCompetitor repository and with GetByCriteria method. The cache component use the Specification Pattern object for retrieving the key to the real cache implementation, and I tell cache component that the classname is (ClientCompetitor). The className is used because I can register other method as cache invalidator, as an example I can tell that the method Save of ClientCompetitor repository will invalidate the entire ClientCompetitor class.</p>
<p>When the interceptor is configured, I can simply tell castle to apply it to ClientCompetitor repository class, and the game is done.</p>
<p>Then I rerun the code and only one query gets issued, with no modification to the original code.</p>
<p>alk. </p>

<p><a href="http://feedads.g.doubleclick.net/~a/qBLBe9WlF6DSHr5VrwtDUduoNQE/0/da"><img src="http://feedads.g.doubleclick.net/~a/qBLBe9WlF6DSHr5VrwtDUduoNQE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/qBLBe9WlF6DSHr5VrwtDUduoNQE/1/da"><img src="http://feedads.g.doubleclick.net/~a/qBLBe9WlF6DSHr5VrwtDUduoNQE/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=fqO76URCijg:p6yR9npWPmc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=fqO76URCijg:p6yR9npWPmc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=fqO76URCijg:p6yR9npWPmc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=fqO76URCijg:p6yR9npWPmc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=fqO76URCijg:p6yR9npWPmc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=fqO76URCijg:p6yR9npWPmc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/fqO76URCijg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/07/cache-layer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/07/cache-layer/</feedburner:origLink></item>
		<item>
		<title>Use TFS 2010 build to execute arbitrary task</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/z3GUAn3ap_8/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/07/use-tfs-2010-build-to-execute-arbitrary-task/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 08:15:07 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[TFS Build]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/07/use-tfs-2010-build-not-to-build/</guid>
		<description><![CDATA[
			
				
			
		
When you deal with continuous integration, building source is just one part of the problem, you need to run test, calculate metrics, deploy on test server and so on. To orchestrate the execution of integration scripts you need an infrastructure that is capable of scheduling, logging, distribution of agent and a central point of manteniance, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F07%2Fuse-tfs-2010-build-to-execute-arbitrary-task%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F07%2Fuse-tfs-2010-build-to-execute-arbitrary-task%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>When you deal with continuous integration, building source is just one part of the problem, you need to run test, calculate metrics, deploy on test server and so on. To orchestrate the execution of integration scripts you need an infrastructure that is capable of scheduling, logging, distribution of agent and a central point of manteniance, TFS2010 build system has all this characteristics and many other that makes is suitable to run integration script, not only build one.</p>
<p>Tfs2010 build system essentially runs a window workflow 4.0 script to do some standard operation like, build, run test, gated checkin, and bla bla bla, but nothing prevents you to use it to execute operation different from building sources. To make a very trivial example, just go to the source folder of a team project, locate the folder <em>BuildProcessTemplate </em>and create a copy of DefaultTemplate.xaml, now check in and start modifying it removing arguments, variable etc.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb1.png" width="850" height="520" /></a></p>
<p><strong>Figure1:</strong><em> A simple build to log something</em>.</p>
<p>In Figure1 I show a very trivial build, I removed completely everything, I create a sequence with very few actions, just to demonstrate that you can create a build that actually does not build anything, but it just execute an arbitrary workflow. </p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled2" border="0" alt="Untitled2" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled2_thumb.png" width="609" height="678" /></a>    </p>
<p><strong>Figure2:</strong> <em>A detailed view of the build steps.</em></p>
<p>In Figure2 I give you a more detailed description of the trivial build, the first two activities are needed to recover build details and to update the build number, because build number is used in the logging system of TFS and if you do not update it, you will end with build called 1, 2, 3, etc. For this example I’ve decided to give the build a number composed by the name of the build, followed by the sequential id. Finally I insert a couple of WriteBuildMessage activities, just to log something on the build. Since I’m planning to build a skeleton to create a custom workflow that deploy a specific build, in Figure1 you can see that there is a parameter called BuildToUse, when you create a new build, and choose this new workflow, you are presented with this only parameter in the “process” tab, as visible in Figure3.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled3" border="0" alt="Untitled3" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled3_thumb.png" width="650" height="294" /></a><strong></strong></p>
<p><strong>Figure3:</strong> <em>Choose your new workflow from a build definition</em></p>
<p>In Figure4 you can see the result of a build after the execution completes, as you can see, it simply logged something to the deploy log.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb10.png" width="608" height="321" /></a><strong></strong></p>
<p><strong>Figure4:</strong> <em>The result of the build</em></p>
<p>This example is really trivial, but it shows you that you can use tfs2010 build to execute an arbitrary workflow, but thanks to tfs infrastructure you have all the benefit of a standard build: distributed agent, centralized log inside tfs, etc etc.</p>
<p>The next step is to modify this trivial workflow to execute something useful, like the deploy of a specific build on a test server.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Uc1mZhnjHYrkuN97JzcRyHOoTN4/0/da"><img src="http://feedads.g.doubleclick.net/~a/Uc1mZhnjHYrkuN97JzcRyHOoTN4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Uc1mZhnjHYrkuN97JzcRyHOoTN4/1/da"><img src="http://feedads.g.doubleclick.net/~a/Uc1mZhnjHYrkuN97JzcRyHOoTN4/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=z3GUAn3ap_8:5RU1FRDYOAw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=z3GUAn3ap_8:5RU1FRDYOAw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=z3GUAn3ap_8:5RU1FRDYOAw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=z3GUAn3ap_8:5RU1FRDYOAw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=z3GUAn3ap_8:5RU1FRDYOAw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=z3GUAn3ap_8:5RU1FRDYOAw:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/z3GUAn3ap_8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/07/use-tfs-2010-build-to-execute-arbitrary-task/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/07/use-tfs-2010-build-to-execute-arbitrary-task/</feedburner:origLink></item>
		<item>
		<title>Deploy on remote machine during builds</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/XrEC4fYgZSA/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 07:21:21 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tools and library]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/</guid>
		<description><![CDATA[
			
				
			
		
Clearly Lab Management is really good to manage virtual environments and give a lot of flexibility on how to deploy your application on virtual machines, but if you do not have Lab Management you can still use the same technique to deploy application in remote computer during a build with the use of a simple [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F06%2Fdeploy-on-remote-machine-during-builds%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F06%2Fdeploy-on-remote-machine-during-builds%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Clearly Lab Management is really good to <a target="_blank" href="http://www.codewrecks.com/blog/index.php/2010/06/29/deploy-a-solution-and-a-database-in-a-lab-management-virtual-environment/">manage virtual environment</a>s and give a lot of flexibility on how to deploy your application on virtual machines, but if you do not have Lab Management you can still use the same technique to deploy application in remote computer during a build with the use of a simple scripts. The key is the ability to execute code on a remote computer with <a href="http://www.beyondlogic.org/solutions/remoteprocess/BeyondExec.htm">beyondexec</a> or similar tool. Suppose you need to deploy an application called demo, you have a Tfs build called Demo, and you want to be able to deploy a specific build on a remote server, the solution could be this simple script</p>
<p><em><font size="2">@echo off</font></em></p>
<p><em><font size="2">set RemotePath= \\10.0.0.220\drops\demo\%1\_PublishedWebsites\Demo_Package\*.*       <br />set LocalPath=c:\setup\demo</font></em></p>
<p><em><font size="2">if exist %LocalPath% (       <br />rmdir /s /q %LocalPath%        <br />)        <br />mkdir %LocalPath%</font></em></p>
<p><em><font size="2">if not exist %RemotePath% (       <br />echo remote path %RemotePath% doesn&#8217;t exist        <br />goto Error        <br />)</font></em>    <br /><em><font size="2">xcopy /c %RemotePath% %LocalPath%\.       <br />%LocalPath%\Demo.deploy.cmd /Y</font></em></p>
<p><em><font size="2">echo Demo Copied to LocalPath %LocalPath%       <br />exit /b 0</font></em></p>
<p><em><font size="2">:Error       <br />echo Unable to Copy Demo Scripts        <br />exit /b 1</font></em></p>
<p>The script is really simple, it simply compose the drop folder <a target="_blank" href="file://\\10.0.0.220\drops\demo">\\10.0.0.220\drops\demo</a> with the single argument of the batch to find the path where the build had dropped the packages, then it creates a local directory where to copy all deploy plackage and run it.</p>
<p>Now you can store this script in source control, and use it with a tfs build, to deploy on a remote server, you can for example run from a command prompt:</p>
<p><strong><em>beyondexecv2 \\10.0.0.220 -p &quot;pa$$word” -c Deploy\DeployWeb.bat demo_20100607.3</em></strong></p>
<p>This will copy the script on the 10.0.0.220 server, and launch the script with the argument demo_20100607.3 (the build number), here is the result.</p>
<p><em><font size="1" face="Consolas">BeyondExec V2.05 &#8211; Spawn Remote Processes on Windows NT/2000/XP WorkStations.       <br />Copyright(C) 2002-2003 Craig.Peacock@beyondlogic.org        <br />[10.0.0.220] Establishing Connection . . .        <br />[10.0.0.220] BeyondExec service already installed on remote machine.        <br />[10.0.0.220] Copying Deploy\DeployWeb.bat to \\10.0.0.220\ADMIN$\temp\DeployWeb.bat        <br />[10.0.0.220] Command Successfully Issued to 10.0.0.220 on Pipe 1.        <br />[win-y4onzs094up] Process started, ProcessID = 9780, ThreadID = 9788        <br />\\10.0.0.220\drops\demo\demo_20100607.3\_PublishedWebsites\Demo_Package\Demo.deploy-readme.txt        <br />\\10.0.0.220\drops\demo\demo_20100607.3\_PublishedWebsites\Demo_Package\Demo.deploy.cmd        <br />\\10.0.0.220\drops\demo\demo_20100607.3\_PublishedWebsites\Demo_Package\Demo.SetParameters.xml        <br />\\10.0.0.220\drops\demo\demo_20100607.3\_PublishedWebsites\Demo_Package\Demo.SourceManifest.xml        <br />\\10.0.0.220\drops\demo\demo_20100607.3\_PublishedWebsites\Demo_Package\Demo.zip        <br />5 File(s) copied        <br />=========================================================        <br />SetParameters from:        <br />&quot;c:\setup\demo\Demo.SetParameters.xml&quot;        <br />You can change IIS Application Name, Physical path, connectionString        <br />or other deploy parameters in the above file.        <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-        <br /> Start executing msdeploy.exe        <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-        <br /> &quot;C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe&quot; -source:package=&#8217;c:\setup\demo\Demo.zip&#8217; -dest:auto,includeAcls=&#8217;False&#8217; -verb:syn        <br />c -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:&quot;c:\setup\demo\Demo.SetParamet        <br />ers.xml&quot;        <br />Info: Adding sitemanifest (sitemanifest).        <br />Info: Updating createApp (Default Web Site/Demo_deploy).        <br />Info: Adding contentPath (Default Web Site/Demo_deploy).        <br />…        <br />Info: Adding setAcl (Default Web Site/Demo_deploy).        <br />Total changes: 37 (36 added, 0 deleted, 1 updated, 0 parameters changed, 737702 bytes copied)        <br />[win-y4onzs094up] Process terminated with exit code 0 after 00:00:03.850s        <br />[win-y4onzs094up] Removing C:\Windows\temp\DeployWeb.bat</font></em></p>
<p>As you can verify, the beyondexec tool was able to connect to remote machine, copied the deployweb.bat script on the remote machine and launched it with the right argument, now I can verify with IIS that the new web application was created in target machine. </p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb9.png" width="322" height="265" /></a></p>
<p>Et voilà, we deployed a web application to a remote machine with a simple command. You can use this technique in a tfs build to deploy to a remote server.</p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/GWUfdDBcHlJUBpIaauqnhYd7itk/0/da"><img src="http://feedads.g.doubleclick.net/~a/GWUfdDBcHlJUBpIaauqnhYd7itk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/GWUfdDBcHlJUBpIaauqnhYd7itk/1/da"><img src="http://feedads.g.doubleclick.net/~a/GWUfdDBcHlJUBpIaauqnhYd7itk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=XrEC4fYgZSA:SRrBs7i2QS8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=XrEC4fYgZSA:SRrBs7i2QS8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=XrEC4fYgZSA:SRrBs7i2QS8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=XrEC4fYgZSA:SRrBs7i2QS8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=XrEC4fYgZSA:SRrBs7i2QS8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=XrEC4fYgZSA:SRrBs7i2QS8:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/XrEC4fYgZSA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/</feedburner:origLink></item>
		<item>
		<title>Extremely slow operation and log4net</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/-o3-plvKSbw/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 11:52:24 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/</guid>
		<description><![CDATA[
			
				
			
		
&#160;
I’m currently profiling a web application, and I noticed that for some combination of input, a specific search into the database is really really slow. After verifying that the query is not responsible for this problem I fire a profiler, load the page, issue the search and then verify with ant profiler the method that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F05%2Fextremely-slow-operation-and-log4net%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F05%2Fextremely-slow-operation-and-log4net%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>&#160;</p>
<p>I’m currently profiling a web application, and I noticed that for some combination of input, a specific search into the database is really really slow. After verifying that the query is not responsible for this problem I fire a profiler, load the page, issue the search and then verify with ant profiler the method that need more time to be executed. The result was that the method that needs more time to be executed is one called Send Alert, that simply logs with log4net to a specific logger called Alert.</p>
<p>I noticed a lot of SocketException, so I verify the configuration, and find that the Alert logger has a reference to a SmtpAppender that points to a wrong smtp server. The page was slow because it is waiting to send an alert with a wrong mailserver, then it waits for timeout before proceeding on.</p>
<p>Ok, this is a configuration problem, but I do not want my email alert to be sent synchronously, because there is no point in slowing the application if I need to send an alert. Remember that sending an E-Mail is a slow operation even if the smtp is ok. In this situation Log4Net has a specific appender called AsyncAppender that can be used to solve this problem. The AsyncAppender is a specific appender that is used to wrap any other appender, and make the log asyncronous. The only part I need to change is to add this to configuration</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">appender</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;AsyncSmtpAppender&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;SampleAppendersApp.Appender.AsyncAppender,SampleAppendersApp&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">appender-ref</span> <span style="color: #ff0000">ref</span><span style="color: #0000ff">=&quot;SmtpAppender&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">appender</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p></p>
<p>and use the AsyncSmtpAppender in logger definition.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">logger</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;Alerter&quot;</span> <span style="color: #ff0000">additivity</span><span style="color: #0000ff">=&quot;false&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">level</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;WARN&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">appender-ref</span> <span style="color: #ff0000">ref</span><span style="color: #0000ff">=&quot;AsyncSmtpAppender&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">logger</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>Then I reload the page again, and now, even with a wrong smtp server, the page loads almost instantaneously.</p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/jH2DZr3xVs7jvn3PVRLOHRstCks/0/da"><img src="http://feedads.g.doubleclick.net/~a/jH2DZr3xVs7jvn3PVRLOHRstCks/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/jH2DZr3xVs7jvn3PVRLOHRstCks/1/da"><img src="http://feedads.g.doubleclick.net/~a/jH2DZr3xVs7jvn3PVRLOHRstCks/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=-o3-plvKSbw:pQPxisXoFdU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=-o3-plvKSbw:pQPxisXoFdU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=-o3-plvKSbw:pQPxisXoFdU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=-o3-plvKSbw:pQPxisXoFdU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=-o3-plvKSbw:pQPxisXoFdU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=-o3-plvKSbw:pQPxisXoFdU:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/-o3-plvKSbw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/</feedburner:origLink></item>
		<item>
		<title>NHibernate filter-def for filter named  was never used to filter classes nor collections</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/US__8-CxOTw/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/05/nhibernate-filter-def-for-filter-named-was-never-used-to-filter-classes-nor-collections/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 09:38:25 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/05/nhibernate-filter-def-for-filter-named-was-never-used-to-filter-classes-nor-collections/</guid>
		<description><![CDATA[
			
				
			
		
While I was upgrading a project to the latest version of nhibernate I encounter this error
filter-def for filter named UserContext was never used to filter classes nor collections

The code worked perfectly with the older version of nhibernate, but with the new version it does not work. Thanks to my friend Guardian we have found the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F05%2Fnhibernate-filter-def-for-filter-named-was-never-used-to-filter-classes-nor-collections%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F05%2Fnhibernate-filter-def-for-filter-named-was-never-used-to-filter-classes-nor-collections%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>While I was upgrading a project to the latest version of nhibernate I encounter this error</p>
<blockquote><p>filter-def for filter named UserContext was never used to filter classes nor collections</p>
</blockquote>
<p>The code worked perfectly with the older version of nhibernate, but with the new version it does not work. Thanks to my friend <a target="_blank" href="http://www.primordialcode.com/">Guardian</a> we have found the problem. The problem is due to a filter used only into a formula, the validator of nhibernate configuration, does not find the filter used in any mapping, does not scan formula, and thinks that the filter is never used.</p>
<p>The solution is really simple, in the class that uses the filter, simply add a filter definition that is always verified such as.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">filter</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;UserContext&quot;</span> <span style="color: #ff0000">condition</span>=&quot;<span style="color: #ff0000">Id</span> <span style="color: #0000ff">&gt;</span> 0&quot; <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>And everything works ok.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/x6Z9isPrTPO0NynH50BS5nq-Eas/0/da"><img src="http://feedads.g.doubleclick.net/~a/x6Z9isPrTPO0NynH50BS5nq-Eas/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/x6Z9isPrTPO0NynH50BS5nq-Eas/1/da"><img src="http://feedads.g.doubleclick.net/~a/x6Z9isPrTPO0NynH50BS5nq-Eas/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=US__8-CxOTw:4WmAmrvTvIo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=US__8-CxOTw:4WmAmrvTvIo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=US__8-CxOTw:4WmAmrvTvIo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=US__8-CxOTw:4WmAmrvTvIo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=US__8-CxOTw:4WmAmrvTvIo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=US__8-CxOTw:4WmAmrvTvIo:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/US__8-CxOTw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/05/nhibernate-filter-def-for-filter-named-was-never-used-to-filter-classes-nor-collections/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/05/nhibernate-filter-def-for-filter-named-was-never-used-to-filter-classes-nor-collections/</feedburner:origLink></item>
		<item>
		<title>Visual studio Pro Power Tools Tab Well</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/pQe5kZaDc9E/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/03/visual-studio-pro-power-tools-tab-well/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 10:05:08 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/03/visual-studio-pro-power-tools-tab-well/</guid>
		<description><![CDATA[
			
				
			
		
One of the most exiting addin for VS2010 is the Visual Studio 2010 Pro Power Tools that has a great number of features, but the most interesting one is the Document well, you can read everything about it in this post. 
This really boost productivity for those one having wide monitor, such as 24’’ that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F03%2Fvisual-studio-pro-power-tools-tab-well%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F03%2Fvisual-studio-pro-power-tools-tab-well%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the most exiting addin for VS2010 is the <a target="_blank" href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef">Visual Studio 2010 Pro Power Tools</a> that has a great number of features, but the most interesting one is the Document well, you can <a target="_blank" href="http://blogs.msdn.com/b/visualstudio/archive/2010/06/10/document-well-2010-plus.aspx">read everything about it in this post</a>. </p>
<p>This really boost productivity for those one having wide monitor, such as 24’’ that has a horizontal resolution of 1920 pixels, because I really loved the ability to use vertical document well, with project colored tab. I can immediately visualize the file by project with different color, and visualize a large number of opened files, instead of having them showed in the top, where very few of them are visible.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="Untitled" border="0" alt="Untitled" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/Untitled_thumb.png" width="639" height="577" /></a></p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/CBQ_dXHttUSyfsGdic125UDk1jE/0/da"><img src="http://feedads.g.doubleclick.net/~a/CBQ_dXHttUSyfsGdic125UDk1jE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/CBQ_dXHttUSyfsGdic125UDk1jE/1/da"><img src="http://feedads.g.doubleclick.net/~a/CBQ_dXHttUSyfsGdic125UDk1jE/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=pQe5kZaDc9E:SMyXDWD_l9c:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=pQe5kZaDc9E:SMyXDWD_l9c:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=pQe5kZaDc9E:SMyXDWD_l9c:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=pQe5kZaDc9E:SMyXDWD_l9c:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=pQe5kZaDc9E:SMyXDWD_l9c:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=pQe5kZaDc9E:SMyXDWD_l9c:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/pQe5kZaDc9E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/03/visual-studio-pro-power-tools-tab-well/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/03/visual-studio-pro-power-tools-tab-well/</feedburner:origLink></item>
		<item>
		<title>Intellitrace for asp.net application does not get collected during a test run with MTM</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/_Ny9JKOJpWs/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/02/intellitrace-for-asp-net-application-does-not-get-collected-during-a-test-run-with-mtm/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 07:54:19 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Intellitrace]]></category>
		<category><![CDATA[Microsoft Test Manager]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/02/intellitrace-for-asp-net-application-does-not-get-collected-during-a-test-run-with-mtm/</guid>
		<description><![CDATA[
			
				
			
		
If you have problem collecting intellitrace during a test run with MTM for an asp.net web application, and you really checked everything but cannot find any clue, check the user you are using to run the application. I have an installation where, using the default application pool will result in intellitrace being collected, while if [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F02%2Fintellitrace-for-asp-net-application-does-not-get-collected-during-a-test-run-with-mtm%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F02%2Fintellitrace-for-asp-net-application-does-not-get-collected-during-a-test-run-with-mtm%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>If you have problem collecting intellitrace during a test run with MTM for an asp.net web application, and you really checked everything but cannot find any clue, check the user you are using to run the application. I have an installation where, using the default application pool will result in intellitrace being collected, while if I use a domain user to run application pool, when I try to signal a bug from MTM, no intellitrace is in the bug’s attachment.</p>
<p>The reason of this problem could derive from missing User Profile. Intellitrace is using User Profile to inject environment variables per owner of the application pool, and since User Profile is an OS feature, if no User Profile is loaded by OS, intellitrace could not inject variables, and data gets no collected.</p>
<p>The solution to this problem is to force OS to load user profile for the user before starting the test. Suppose the user that runs the application pool is named tfslab\webAppUsr, you simply need to run this command from a command prompt before you start the test</p>
<p><b>runas&#160; /user:tfslab\webAppUsr /profile cmd.exe</b></p>
<p>This command simply opens a command prompt with the credentials of the user, thus the OS will create the User Profile. Now keep the cmd.exe windows open during the test, run the test again, and this time intellitrace data should be collected.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/OAUilWRNd-AvDNodiNfgQ7aBCeM/0/da"><img src="http://feedads.g.doubleclick.net/~a/OAUilWRNd-AvDNodiNfgQ7aBCeM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OAUilWRNd-AvDNodiNfgQ7aBCeM/1/da"><img src="http://feedads.g.doubleclick.net/~a/OAUilWRNd-AvDNodiNfgQ7aBCeM/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_Ny9JKOJpWs:DtqlHmpW9oY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_Ny9JKOJpWs:DtqlHmpW9oY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_Ny9JKOJpWs:DtqlHmpW9oY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=_Ny9JKOJpWs:DtqlHmpW9oY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_Ny9JKOJpWs:DtqlHmpW9oY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_Ny9JKOJpWs:DtqlHmpW9oY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/_Ny9JKOJpWs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/02/intellitrace-for-asp-net-application-does-not-get-collected-during-a-test-run-with-mtm/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/07/02/intellitrace-for-asp-net-application-does-not-get-collected-during-a-test-run-with-mtm/</feedburner:origLink></item>
		<item>
		<title>Change return value of a mock based on parameters in Rhino mocks</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/Pqn2sSdp29w/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 14:07:41 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools and library]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/</guid>
		<description><![CDATA[
			
				
			
		
Sometimes there is the need to change the return value of an expectation to a Mock with a value based on parameters used in the call. Suppose you need to create a mock, and want to verify that the method DoInt() gets called with a value greater than 42 and it should return the value [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F30%2Fchange-return-value-of-a-mock-based-on-parameters-in-rhino-mocks%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F30%2Fchange-return-value-of-a-mock-based-on-parameters-in-rhino-mocks%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Sometimes there is the need to change the return value of an expectation to a Mock with a value based on parameters used in the call. Suppose you need to create a mock, and want to verify that the method DoInt() gets called with a value greater than 42 and it should return the value augmented by one, how you can setup the expectation?</p>
<p>The secret is in the WhenCalled method exposed by the mock, that permits you to access the full MethodInvocation object that gets generated during the real invocation. Here is the solution.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> interface IDo</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     Int32 DoInt(Int32 param);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> [Test]</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #0000ff">public</span> void Name()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     IDo mock = MockRepository.GenerateStub&lt;IDo&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     mock.Expect(m =&gt; m.DoInt(Arg&lt;Int32&gt;.Matches(param =&gt; param &gt; 42)))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         .WhenCalled(mi =&gt; { mi.ReturnValue = (Int32) mi.Arguments[0] + 1; })</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         .<span style="color: #0000ff">Return</span>(99);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     Int32 retint = mock.DoInt(432);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     Assert.That(retint, <span style="color: #0000ff">Is</span>.EqualTo(433));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>As you can see in the WhenCalled Method I can modify the ReturnValue using the value of a parameter, so if I call mock.DoInt(900) it will return 901. This technique is really powerful, because in WhenCalled you specify a delegate that gets called at each invocation, so you can write code like this.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> IDo mock = MockRepository.GenerateStub&lt;IDo&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> Int32 valueToIncrement = 2;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> mock.Expect(m =&gt; m.DoInt(Arg&lt;Int32&gt;.Matches(param =&gt; param &gt; 42)))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     .WhenCalled(mi =&gt; { mi.ReturnValue = (Int32)mi.Arguments[0] + valueToIncrement; })</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     .Repeat.<span style="color: #0000ff">Any</span>()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     .<span style="color: #0000ff">Return</span>(99);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> Int32 retint = mock.DoInt(432);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> Assert.That(retint, <span style="color: #0000ff">Is</span>.EqualTo(434));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> valueToIncrement = 100;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> retint = mock.DoInt(432);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> Assert.That(retint, <span style="color: #0000ff">Is</span>.EqualTo(532));</pre>
<p><!--CRLF--></div>
</p></div>
<p>I use a local variable to hold the quantity used to increment argument value, if I change the value between invocations, I can change returned value, showing that I can have full dynamic control on the value returned by an expectation on a Mock.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Xo8LEYAvwvOMag377HV7NAM2Ijg/0/da"><img src="http://feedads.g.doubleclick.net/~a/Xo8LEYAvwvOMag377HV7NAM2Ijg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Xo8LEYAvwvOMag377HV7NAM2Ijg/1/da"><img src="http://feedads.g.doubleclick.net/~a/Xo8LEYAvwvOMag377HV7NAM2Ijg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Pqn2sSdp29w:LWensM_992w:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Pqn2sSdp29w:LWensM_992w:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Pqn2sSdp29w:LWensM_992w:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=Pqn2sSdp29w:LWensM_992w:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Pqn2sSdp29w:LWensM_992w:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Pqn2sSdp29w:LWensM_992w:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/Pqn2sSdp29w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/</feedburner:origLink></item>
		<item>
		<title>Deploy a solution and a database in a Lab Management Virtual Environment</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/QpLSZ4UUqwY/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/29/deploy-a-solution-and-a-database-in-a-lab-management-virtual-environment/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 12:54:00 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Lab Management]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/29/deploy-a-solution-and-a-database-in-a-lab-management-virtual-environment/</guid>
		<description><![CDATA[
			
				
			
		
One of the coolest feature of Tfs2010 is Lab Management, an infrastructure tool that permits you to manage Virtual Environment to test your applications. Once you have defined some template machine in SCVMM you can import them into your Lab to be used in defining Virtual Environment.

When you imported all the templates you need from [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F29%2Fdeploy-a-solution-and-a-database-in-a-lab-management-virtual-environment%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F29%2Fdeploy-a-solution-and-a-database-in-a-lab-management-virtual-environment%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the coolest feature of Tfs2010 is Lab Management, an infrastructure tool that permits you to manage Virtual Environment to test your applications. Once you have defined some <a href="http://www.codewrecks.com/blog/index.php/2010/04/12/preparing-template-machine-for-lab-management/">template machine</a> in SCVMM you can import them into your Lab to be used in defining Virtual Environment.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb.png" width="627" height="267" /></a></p>
<p>When you imported all the templates you need from SCVMM, to create a new environment you simply need to go to <em>Environment</em> tab, and create new virtual environment, then you can choose VM template to compose a test environment, like in the following picture where I choose three machine, a web server, a db server and a client machine.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb1.png" width="790" height="385" /></a></p>
<p>This is the great power of Lab Management, the ability to compose virtual machines to create a test environment that permits you to run tests in a variety of different situations. Once you have deployed an environment you can view it into Lab Management, in this screenshot the environment is starting, so Workflow capability is still not ready. All machine to be used in lab environment should in fact have the necessary agent to be controllable from the lab, you can find a prep tool at this address (<a target="_blank" href="http://vslabmgmt.codeplex.com/">http://vslabmgmt.codeplex.com/</a>) that can dramatically cut down the time needed to prepare machines.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb2.png" width="629" height="381" /></a>&#160;</p>
<p>Once an environment is up and running, you can use it to do a lot of interesting operations, but the most interesting one is setup a Lab Management enabled Tfs Build, that has the purpose to compile the application and to deploy the latest version into the virtual environment and running automatic test, everything with a simple click. Defining a Lab Management build is quite simple, first of all I login into database server and IIS machine and prepares them to host my application, I created IIS sites, create the first skeleton of the database, create deploy scripts (they will be examined later), moved to the servers everything is needed to deploy script, and when everything is ready I did a snapshot to save everything. Then I create a standard Tfs Build with this only little difference: I want msbuild to create deploy packages for my web site, so I specify a couple of property to MsBuild.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb3.png" width="652" height="226" /></a></p>
<p>Now I can create another build, this one with the LabDefaultTemplate.xaml, and when you configure the settings you can do very interesting stuff, in the first screenshot I can choose an environment where to run the build, and a valid snapshot to restore before the build take place</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb4.png" width="720" height="150" /></a></p>
<p>For all those people that does continues integration, you know the pain of maintaining scripts when the test environment can be messed up by dev/tester. I remember situation where the integration fails because a dev had stopped IIS Site to do some configuration then he never restart it again, sometimes they mess the application pool or the machine, etc etc. Having the environment restored to a clean snapshot is a real good thing, because we are sure that deploy scripts will run in a clean and tested scenario.</p>
<p>This is especially interesting for production upgrade, I can setup an environment that is the exact copy of production, then take a snapshot, and verifying that deploy script are able to upgrade production environment without messing things. With this approach, testers will run tests against a copy of production environment upgraded to latest version, and this can give you great confidence with the upgrade procedure. </p>
<p>Then you can choose the build to use to generate artifacts, you can choose a build definition and ask to queue another build, or use an existing one, or simply gets a build having a location.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb5.png" width="553" height="314" /></a></p>
<p>Then it comes the most feared part, the deploy one <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/wlEmoticonsmile.png" /></p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb6.png" width="604" height="420" /></a></p>
<p>Apart the fact that you can take a snapshot of the environment after the deploy succeeded (useful to having a repeatable test), you need to create deploy scripts.</p>
<p>Scripts are used because each environment could be isolated from other ones thanks to network fencing, so the simplest stuff to install software on an environment is: copy a batch file in one of the machine, run the batch file and let him deploy the application. This part seems to be really complex, but thanks to database project, and new installer capability of VS2010 for Web application, building such a scripts is really straightforward for web application. First of all, the Virtual Machine column listed logical name of the machines in the environment, so lab management is responsible to understand the real name of the machine, then there is the script to launch, and finally in the last column, the directory in the target machine where the script should be run. Here is an example of how to specify the script</p>
<p><em><strong>$(BuildLocation)\Scripts\DeployDb.bat &quot;$(BuildLocation)&quot;</strong></em></p>
<p>Scripts are located into the web project under the scripts directory, and are part of the solution, so they gets deployed during the build, and are available to the build location. All the scripts accepts only the build location as single argument.</p>
<p>Essentially each script has a first part that is common to each one, it verifies that the directory passed as argument exists, then it creates a local directory where the deploy should take place, setup some variables, and then it does the deploy, for the database we need two lines.</p>
<p><em><strong>xcopy /c %RemotePath%\IBuySpy*.* %LocalPath%\.       <br />C:\Setup\vsdbcmd\vsdbcmd.exe /a:Deploy /ConnectionString:&quot;xxx&quot; /dsp:SQL /manifest:%LocalPath%\IBuySpyDatabase.deploymanifest /p:TargetDatabase=Store /dd</strong></em></p>
<p>It essentially copy all the database project output files into a local folder, then it run the vsdbcmd.exe command to update local database. The vsdbcmd.exe command was already copied to the server in the preparation phase. The good fact is that deploy is just a matter of a couple of lines of code, for the web application the situation is quite the same.</p>
<p><strong><em>xcopy /c %RemotePath%\_PublishedWebsites\WebApplication5_Package\*.* %LocalPath%\.       <br />%LocalPath%\WebApplication5.deploy.cmd /Y</em></strong></p>
<p>The first line is used to copy the deploy package, from the build location to a local path, the script knows that the build will drop the packages in a _PublishedWebSites subdirectory, and finally it can simply launch the command file to deploy the application to IIS.</p>
<p>As you can see, deploying a solution into a virtual environment can seem complicated as first, but is is only a matter of a couple of lines into a bat file, for standard project. Moreover, having such a script is a good things because you can use them to automatically deploy application even outside of lab management build.</p>
<p>Now you can choose test to run and launch the lab management build, here is a simple result</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb7.png" width="780" height="314" /></a></p>
<p>If you look at detailed build output you can find the whole output of the scripts</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb8.png" width="529" height="446" /></a></p>
<p>Thanks to lab management, you can, with a simple click, having your latest source deployed to an environment and be ready to be used from tester. If you have good servers and space on disk, you can build as many environment as you need. As an example you can deploy a environment with two IIS machine, just to test your app in a load balancing scenario.</p>
<p>Managing virtual environment with lab management is really funny and productive, and can cut off dramatically the time and cost needed to test your application.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/OLE6f48vK2ISQR7OoiJCWSv2tYs/0/da"><img src="http://feedads.g.doubleclick.net/~a/OLE6f48vK2ISQR7OoiJCWSv2tYs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OLE6f48vK2ISQR7OoiJCWSv2tYs/1/da"><img src="http://feedads.g.doubleclick.net/~a/OLE6f48vK2ISQR7OoiJCWSv2tYs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=QpLSZ4UUqwY:o4FHNYddrXY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=QpLSZ4UUqwY:o4FHNYddrXY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=QpLSZ4UUqwY:o4FHNYddrXY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=QpLSZ4UUqwY:o4FHNYddrXY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=QpLSZ4UUqwY:o4FHNYddrXY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=QpLSZ4UUqwY:o4FHNYddrXY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/QpLSZ4UUqwY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/29/deploy-a-solution-and-a-database-in-a-lab-management-virtual-environment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/29/deploy-a-solution-and-a-database-in-a-lab-management-virtual-environment/</feedburner:origLink></item>
		<item>
		<title>Hackability</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/_jhas_JdjmE/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/29/hackability/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 09:01:33 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/29/hackability/</guid>
		<description><![CDATA[
			
				
			
		
I really believe that such a word (Hackability) does not exists  but a tweet I saw minutes ago makes me think a little bit, the tweet was this one
I hear about Wordpress blogs getting hacked HOURLY. What is it about WP that makes it so hacker friendly?
The answer is simple IMHO, wordpress is the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F29%2Fhackability%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F29%2Fhackability%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I really believe that such a word (Hackability) does not exists <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/wlEmoticonsmile.png" /> but a tweet I saw minutes ago makes me think a little bit, the tweet was this one</p>
<p><em><strong>I hear about Wordpress blogs getting hacked HOURLY. What is it about WP that makes it so hacker friendly?</strong></em></p>
<p>The answer is simple IMHO, wordpress is the most used blog engine, so hackers always try to break it, because if you hack wordpress you virtually hack a large amount of blogs, while if you hack other blog platform you will hack a minor number of sites. I’m not an hacker, but I think that even if a site engine is really hard to break, if it is used by millions of people it worth trying to break it, and since no product is bugfree, surely some flaws will be found. Every program used by millions of people can be hacker friendly <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smilewithtongueout" alt="Smile with tongue out" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/wlEmoticonsmilewithtongueout.png" /></p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/8VNGRKOW_icdXEBh1vEV6zQsvxs/0/da"><img src="http://feedads.g.doubleclick.net/~a/8VNGRKOW_icdXEBh1vEV6zQsvxs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8VNGRKOW_icdXEBh1vEV6zQsvxs/1/da"><img src="http://feedads.g.doubleclick.net/~a/8VNGRKOW_icdXEBh1vEV6zQsvxs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_jhas_JdjmE:MQUylgXQB2U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_jhas_JdjmE:MQUylgXQB2U:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_jhas_JdjmE:MQUylgXQB2U:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=_jhas_JdjmE:MQUylgXQB2U:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_jhas_JdjmE:MQUylgXQB2U:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=_jhas_JdjmE:MQUylgXQB2U:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/_jhas_JdjmE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/29/hackability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/29/hackability/</feedburner:origLink></item>
		<item>
		<title>Changing application configuration file from a deployed click once application</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/YvbXpEGsDgY/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/28/changing-application-configuration-file-from-a-deployed-click-once-application/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 15:45:02 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/28/changing-application-configuration-file-from-a-deployed-click-once-application/</guid>
		<description><![CDATA[
			
				
			
		
I have a simple scenario, I have an application deployed internally with click once, and some of the internal versions are made avaliable externally. The problem is that I need to change the application configuration file before deploying them to production server. To accomplish this you can simply locate the file applicationname.exe.config.deploy in the deploy [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F28%2Fchanging-application-configuration-file-from-a-deployed-click-once-application%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F28%2Fchanging-application-configuration-file-from-a-deployed-click-once-application%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I have a simple scenario, I have an application deployed internally with click once, and some of the internal versions are made avaliable externally. The problem is that I need to change the application configuration file before deploying them to production server. To accomplish this you can simply locate the file applicationname.exe.config.deploy in the deploy directory of clickonce, but if you change it you will got an error during installation similar to this one</p>
<p><em>Application manifest has either a different computed hash than the one specified or no hash specified at all</em></p>
<p>Probably the exact error is different, but the general problem is that the manifest of your application contains hashes of all the file, and when you change a file you need to update all the mamifests. To accomplish this you need to enter to the directory with the version you want to change (Es. \Application files\applicationname_1_2_0_0) and issue from a visual studio command prompt the following command</p>
<p><em>mage –u applicationname.application</em></p>
<p>then go to the root of the deployed application and issue the command</p>
<p><em>mage -u applicationname.application -Version x.x.x.x -AppManifest &quot;Application Files\applicationname_x_x_x_X\applicationname.exe.manifest&quot; -Processor msil</em></p>
<p>this will recompute your hashes and now you should be able to install application again.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/nMNqH17tRpNUbNUkzwEiQBtdL8w/0/da"><img src="http://feedads.g.doubleclick.net/~a/nMNqH17tRpNUbNUkzwEiQBtdL8w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nMNqH17tRpNUbNUkzwEiQBtdL8w/1/da"><img src="http://feedads.g.doubleclick.net/~a/nMNqH17tRpNUbNUkzwEiQBtdL8w/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=YvbXpEGsDgY:WC0yHpB3ccY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=YvbXpEGsDgY:WC0yHpB3ccY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=YvbXpEGsDgY:WC0yHpB3ccY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=YvbXpEGsDgY:WC0yHpB3ccY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=YvbXpEGsDgY:WC0yHpB3ccY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=YvbXpEGsDgY:WC0yHpB3ccY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/YvbXpEGsDgY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/28/changing-application-configuration-file-from-a-deployed-click-once-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/28/changing-application-configuration-file-from-a-deployed-click-once-application/</feedburner:origLink></item>
		<item>
		<title>Move a click once deployed application between servers</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/6Dzn9EUurAc/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/28/move-a-click-once-deployed-application-between-servers/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 15:05:01 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/28/move-a-click-once-deployed-application-between-servers/</guid>
		<description><![CDATA[
			
				
			
		
I have a winform application that is distributed internally through a dev server with IIS, the application is distributed in the address
http://10.8.0.5:10444/MyApplicationNameInternal/publish.htm
This application is deployed for internal use and test, and when it is stable it gets deployed to customers machine. To avoid problem I need simply to take the version deployed in our internal [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F28%2Fmove-a-click-once-deployed-application-between-servers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F28%2Fmove-a-click-once-deployed-application-between-servers%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I have a winform application that is distributed internally through a dev server with IIS, the application is distributed in the address</p>
<p><a target="_blank" title="http://10.8.0.5:10444/BuzzManagerInternal/publish.htm" href="http://10.8.0.5:10444/MyApplicationNameInternal/publish.htm">http://10.8.0.5:10444/MyApplicationNameInternal/publish.htm</a></p>
<p>This application is deployed for internal use and test, and when it is stable it gets deployed to customers machine. To avoid problem I need simply to take the version deployed in our internal server and move it in production machine. To do this you can simply move all the content of the IIS folder from the dev server to production server, then use the MageUi.exe program to change the url.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image34.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb34.png" width="756" height="357" /></a></p>
<p>Thanks to mage, I can simply use my internal test server to deploy test version, and release to outside customers only specific versions.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/NiPcZkudxxILfHCPLqNZr0kvBoc/0/da"><img src="http://feedads.g.doubleclick.net/~a/NiPcZkudxxILfHCPLqNZr0kvBoc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/NiPcZkudxxILfHCPLqNZr0kvBoc/1/da"><img src="http://feedads.g.doubleclick.net/~a/NiPcZkudxxILfHCPLqNZr0kvBoc/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=6Dzn9EUurAc:64__LcLEBy8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=6Dzn9EUurAc:64__LcLEBy8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=6Dzn9EUurAc:64__LcLEBy8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=6Dzn9EUurAc:64__LcLEBy8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=6Dzn9EUurAc:64__LcLEBy8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=6Dzn9EUurAc:64__LcLEBy8:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/6Dzn9EUurAc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/28/move-a-click-once-deployed-application-between-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/28/move-a-click-once-deployed-application-between-servers/</feedburner:origLink></item>
		<item>
		<title>Running test in lab management “Error adding test case, there is no test with specified id</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/MZgnEWij-yg/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/16/running-test-in-lab-management-error-adding-test-case-there-is-no-test-with-specified-id/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 16:54:12 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/16/running-test-in-lab-management-error-adding-test-case-there-is-no-test-with-specified-id/</guid>
		<description><![CDATA[
			
				
			
		
One of the most exiting capability of Lab Environment is the ability to 
1) Record a Coded Ui Test   2) Assign it to a test     3) Run the test in an lab management virtual environment.
It is possible that running the test will return an error, and in the log [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F16%2Frunning-test-in-lab-management-error-adding-test-case-there-is-no-test-with-specified-id%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F16%2Frunning-test-in-lab-management-error-adding-test-case-there-is-no-test-with-specified-id%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>One of the most exiting capability of Lab Environment is the ability to </p>
<p>1) Record a Coded Ui Test   <br />2) Assign it to a test     <br />3) Run the test in an lab management virtual environment.</p>
<p>It is possible that running the test will return an error, and in the log you find an error like </p>
<p>Error adding test case [xx] to test run: There is no test with specified Id {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.</p>
<p>The error is due to the fact that you are running your test against a build that does not contain the coded UI Test associated with the Test case. This is a common error if you:</p>
<p>1) register the coded UI Test   <br />2) assign to a Test Case&#160; <br />3) go to MTM and run the test, without changing the build.</p>
<p>To solve this error: queue a build, verify that the build succeeded, then change the build associated with the test plan.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image33.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb33.png" width="578" height="602" /></a> </p>
<p>Be sure that the build in use is one that contains the test associated with automation, then run the test again and everything should succeed.</p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/pF7lO0RUu9ipNMd7Sf7K9FMyvWI/0/da"><img src="http://feedads.g.doubleclick.net/~a/pF7lO0RUu9ipNMd7Sf7K9FMyvWI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/pF7lO0RUu9ipNMd7Sf7K9FMyvWI/1/da"><img src="http://feedads.g.doubleclick.net/~a/pF7lO0RUu9ipNMd7Sf7K9FMyvWI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=MZgnEWij-yg:9CsPAXBfXvo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=MZgnEWij-yg:9CsPAXBfXvo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=MZgnEWij-yg:9CsPAXBfXvo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=MZgnEWij-yg:9CsPAXBfXvo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=MZgnEWij-yg:9CsPAXBfXvo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=MZgnEWij-yg:9CsPAXBfXvo:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/MZgnEWij-yg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/16/running-test-in-lab-management-error-adding-test-case-there-is-no-test-with-specified-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/16/running-test-in-lab-management-error-adding-test-case-there-is-no-test-with-specified-id/</feedburner:origLink></item>
		<item>
		<title>Lab management TF267042 and dns configuration</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/Idm3CYaLsR8/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/15/lab-management-tf267042-and-dns-configuration/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 12:48:32 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Lab Management]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/15/lab-management-tf267042-and-dns-configuration/</guid>
		<description><![CDATA[
			
				
			
		
Today I configured an environment in lab management, when it finishes the deploy phase I see that the machine has testing capabilities “Error” and the details of the error is
 
The real error is the TF267055&#160;
he machine is not ready to run tests because of the following error: Unable to connect to the controller on [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F15%2Flab-management-tf267042-and-dns-configuration%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F15%2Flab-management-tf267042-and-dns-configuration%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Today I configured an environment in lab management, when it finishes the deploy phase I see that the machine has testing capabilities “Error” and the details of the error is</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/Capture.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Capture" border="0" alt="Capture" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/Capture_thumb.png" width="778" height="308" /></a> </p>
<p>The real error is the <a target="_blank" href="http://blogs.msdn.com/b/lab_management/archive/2009/10/26/troubleshooting.aspx#e3_10">TF267055</a>&#160;</p>
<p>he machine is not ready to run tests because of the following error: Unable to connect to the controller on labrtmhost.tfslab.nablasoft.com:6901&#8242;. Reason: A connection attempt failed because the connected party did not properly respond after a period of time…… host has failed to respond 10.0.0.110:6901</p>
<p>This is the configuration of this test machine.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image30.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb30.png" width="486" height="210" /></a> </p>
<p>Physical machine has a wirless in 10.0.0.110 IP, that communicates with my office network, then it has the 10.10.1.3 ip on a Internal Virtual Network of Hyper-V where the lab manager environment is running. Since the error states that the agent is trying to contact the controller on 10.0.0.110 ip it is clear that configuration fails, because the lab machine has only the ip 10.10.1.100 and has no way to connect to the 10.0.0.x network.</p>
<p>If I connect to the lab Machine and did a ping labrtmhost&#160; I got a correct answer from the ip 10.10.1.3, but the problem happened during configuration of test controller. To solve this problem first of all you need to check the Active Directory DNS, and I verified that for labrtmhost machine both ip are recorded. Since the Active Directory is active only on the 10.10.1.x subnetwork there is no need to have other ip registered, so I deleted from the dns. This is not enough, because I needed to go to labrtmhost, open the configuration of the wireless network card (the one with 10.0.0.110 ip) and prevent it to register ip into the dns.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image31.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb31.png" width="409" height="488" /></a> </p>
<p>Then I verified that from all machine in the network if I try to resolve labrtmhost with nslookup it gives me only the address 10.10.1.3. Now I reopened the “TEst Controller Configuration Tool” and configured again the test controller from the labrtmhost machine, this time it got registered in tfs with the correct Ip. Now I repair testing capabilities on the lab management deployed machine and everything is now ok.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image32.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb32.png" width="365" height="299" /></a> </p>
<p>So, wenever you got a <a target="_blank" href="http://blogs.msdn.com/b/lab_management/archive/2009/10/26/troubleshooting.aspx#e3_10">TF267055</a> error, always check the dns and dns registration and verify that the test controller is registered with the correct ip.</p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/E8t8hWDbzFR7YfoPpthdKVSbP3g/0/da"><img src="http://feedads.g.doubleclick.net/~a/E8t8hWDbzFR7YfoPpthdKVSbP3g/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/E8t8hWDbzFR7YfoPpthdKVSbP3g/1/da"><img src="http://feedads.g.doubleclick.net/~a/E8t8hWDbzFR7YfoPpthdKVSbP3g/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Idm3CYaLsR8:uvHi05pkRMo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Idm3CYaLsR8:uvHi05pkRMo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Idm3CYaLsR8:uvHi05pkRMo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=Idm3CYaLsR8:uvHi05pkRMo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Idm3CYaLsR8:uvHi05pkRMo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Idm3CYaLsR8:uvHi05pkRMo:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/Idm3CYaLsR8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/15/lab-management-tf267042-and-dns-configuration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/15/lab-management-tf267042-and-dns-configuration/</feedburner:origLink></item>
		<item>
		<title>Managing Multiple TFS Build Agents with tag</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/kTTthAWeH0Y/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/14/managing-multiple-tfs-build-agents-with-tag/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 17:22:01 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[TFS Build]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/14/managing-multiple-tfs-build-agents-with-tag/</guid>
		<description><![CDATA[
			
				
			
		
In last post I explain how to run code coverage during a Tfs Build and I mentioned the fact that to run code coverage you need to have Visual Studio premium or ultimate in the build machine. But what happens when you have multiple configured test agent, and only some of them have VS installed?
The [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F14%2Fmanaging-multiple-tfs-build-agents-with-tag%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F14%2Fmanaging-multiple-tfs-build-agents-with-tag%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In last post I explain <a href="http://www.codewrecks.com/blog/index.php/2010/06/14/running-code-coverage-in-tfs2010-builds/">how to run code coverage during a Tfs Build</a> and I mentioned the fact that to run code coverage you need to have Visual Studio premium or ultimate in the build machine. But what happens when you have multiple configured test agent, and only some of them have VS installed?</p>
<p>The solution to such a problem is using <a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb399135.aspx#assign_tags">tags with the build agents</a>. Basically a tag is a string that gets assigned to a build agent, and identify some capabilities of the Agent Itself. In our example, we can define a tag called <em>VSUltimate</em> that is used for each build agent that runs on a machine with Visual Studio Ultimate installed. Adding a tag is just a matter of going to the Agent Configuration</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image27.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb27.png" width="634" height="274" /></a> </p>
<p>One good aspect of tagging, is that TFS remembers all inserted tags, so when it is time to configure tagging on another build agent, you got a list of all tags already used. You can verify from the above picture that this agent has the VSUltimate tag, but not the Windows7 one.</p>
<p>Now you can simply choose in the build definition the tag you require for the build. In our example, since our build should collect code coverage result, I want it to be executed from an agent that has Visual Studio Ultimate installed.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image29.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb29.png" width="690" height="344" /></a> </p>
<p>Thanks to the tag system you can simply specify in the build the feature you need to run the build itself.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/s9ZL0QPJ9uW_N9vXCyL8ymzJP8g/0/da"><img src="http://feedads.g.doubleclick.net/~a/s9ZL0QPJ9uW_N9vXCyL8ymzJP8g/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/s9ZL0QPJ9uW_N9vXCyL8ymzJP8g/1/da"><img src="http://feedads.g.doubleclick.net/~a/s9ZL0QPJ9uW_N9vXCyL8ymzJP8g/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=kTTthAWeH0Y:ACvzFzQih54:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=kTTthAWeH0Y:ACvzFzQih54:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=kTTthAWeH0Y:ACvzFzQih54:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=kTTthAWeH0Y:ACvzFzQih54:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=kTTthAWeH0Y:ACvzFzQih54:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=kTTthAWeH0Y:ACvzFzQih54:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/kTTthAWeH0Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/14/managing-multiple-tfs-build-agents-with-tag/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/14/managing-multiple-tfs-build-agents-with-tag/</feedburner:origLink></item>
		<item>
		<title>Running Code Coverage in Tfs2010 Builds</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/PsAGG0INc_o/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/14/running-code-coverage-in-tfs2010-builds/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 08:39:00 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[TFS Build]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/14/running-code-coverage-in-tfs2010-builds/</guid>
		<description><![CDATA[
			
				
			
		
To have Code Coverage collection for test execution during a build, you first need to create a .testsettings file in the solution with code coverage enabled. To enable code coverage simply open the testsetting file, go to “Data And Diagnostics” and check the “Code coverage” option. This is not enough, because when you check the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F14%2Frunning-code-coverage-in-tfs2010-builds%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F14%2Frunning-code-coverage-in-tfs2010-builds%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>To have Code Coverage collection for test execution during a build, you first need to create a .testsettings file in the solution with code coverage enabled. To enable code coverage simply open the testsetting file, go to “Data And Diagnostics” and check the “Code coverage” option. This is not enough, because when you check the code coverage option, the “Configure” link highlighted in the picture become enabled.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image21.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb21.png" width="738" height="540" /></a> </p>
<p>Since Code Coverage works with instrumentation, you need to configure the assemblies you want to instrument, in my examplce only the MyMath assembly</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image22.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb22.png" width="546" height="256" /></a> </p>
<p>To verify that everything is ok just run the test locally and verify that code coverage data is collected. Now you can specify the testsetting file in the build configuration.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image23.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb23.png" width="741" height="238" /></a> </p>
<p>You need also to know that in order to collect code coverage settings, you need to have visual studio Premium or Visual Studio Ultimate installed in the machine with the build agent. If you got no code coverage during the build you should check the detailed log, that contains detailed reason and test run output.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image24.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb24.png" width="447" height="135" /></a> </p>
<p>If you see this message it means that tests were executed in a machine that has not visual studio ultimate, so the code coverage is disabled. If everything is ok, you should see code coverage result directly in the build output.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image25.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb25.png" width="449" height="269" /></a> </p>
<p>To look at code coverage details, you need to click on “View Test Results” and view code coverage output as if it were executed locally.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image26.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb26.png" width="786" height="204" /></a> </p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/HtKT2XGxicbYHvjRJPetQIAStdw/0/da"><img src="http://feedads.g.doubleclick.net/~a/HtKT2XGxicbYHvjRJPetQIAStdw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/HtKT2XGxicbYHvjRJPetQIAStdw/1/da"><img src="http://feedads.g.doubleclick.net/~a/HtKT2XGxicbYHvjRJPetQIAStdw/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=PsAGG0INc_o:hkxTR4fr9jI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=PsAGG0INc_o:hkxTR4fr9jI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=PsAGG0INc_o:hkxTR4fr9jI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=PsAGG0INc_o:hkxTR4fr9jI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=PsAGG0INc_o:hkxTR4fr9jI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=PsAGG0INc_o:hkxTR4fr9jI:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/PsAGG0INc_o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/14/running-code-coverage-in-tfs2010-builds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/14/running-code-coverage-in-tfs2010-builds/</feedburner:origLink></item>
		<item>
		<title>Configuring multiple build agent for TFS 2010 in workgroup environment</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/orDaycaqaeU/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/12/configuring-multiple-build-agent-for-tfs-2010-in-workgroup-environment/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 08:05:17 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[TFS Build]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/12/configuring-multiple-build-agent-for-tfs-2010-in-workgroup-environment/</guid>
		<description><![CDATA[
			
				
			
		
Even if you are in workgroup environment, without a domain, you can distribute your build agent in different machines. The key to achieve this is shadow accounts. I’ve installed as an example a build controller in the tfs machine, then I created an agent, and everything runs as BuildAgent account, created in the Tfs Server [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F12%2Fconfiguring-multiple-build-agent-for-tfs-2010-in-workgroup-environment%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F12%2Fconfiguring-multiple-build-agent-for-tfs-2010-in-workgroup-environment%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Even if you are in workgroup environment, without a domain, you can distribute your build agent in different machines. The key to achieve this is shadow accounts. I’ve installed as an example a build controller in the tfs machine, then I created an agent, and everything runs as BuildAgent account, created in the Tfs Server and added to the “Project collection Build Service account”.</p>
<p>The next step is creating a user called BuildAgent with the same password of the Tfs Server in another machine, suppose a Windows 7 one. Then I log into the Windows 7 machine as Administrator, install Tfs Build and proceed to configuration. When it is time to choose the project collection it asks for credentials, and you should login as BuildAgent, choose the ProjectCollection and then proceed on.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/tfs_build_1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="tfs_build_1" border="0" alt="tfs_build_1" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/tfs_build_1_thumb.png" width="666" height="323" /></a> </p>
<p>In the next screen you are asked if you want to scale out an existing build controller adding agents to it.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/tfs_build_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="tfs_build_2" border="0" alt="tfs_build_2" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/tfs_build_2_thumb.png" width="611" height="454" /></a> </p>
<p>When it is time to choose the user for the build service, simply specify the BuildAgent created in the first step. Since an identical user exists on the tfs machine, it is allowed to access TFS and building projects.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/tfs_build_3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="tfs_build_3" border="0" alt="tfs_build_3" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/tfs_build_3_thumb.png" width="766" height="413" /></a> </p>
<p>Finally you can verify that the agent is configured correctly.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image19.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb19.png" width="666" height="290" /></a> </p>
<p>As you can see in the machine there is an agent configured for machine win-y4onzs094UP that is the tfs basic test machine I used for demo purpose. If you manage the build controller from Visual STudio Team Explorer you can verify that now you have two build agents to use</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image20.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb20.png" width="630" height="309" /></a>&#160; </p>
<p>Even without a domain tfs build environment is really flexible and scalable.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/pcYu6ojMFVJ-KuCdj7m0MnV02YQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/pcYu6ojMFVJ-KuCdj7m0MnV02YQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/pcYu6ojMFVJ-KuCdj7m0MnV02YQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/pcYu6ojMFVJ-KuCdj7m0MnV02YQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=orDaycaqaeU:KThfEaGXWkQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=orDaycaqaeU:KThfEaGXWkQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=orDaycaqaeU:KThfEaGXWkQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=orDaycaqaeU:KThfEaGXWkQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=orDaycaqaeU:KThfEaGXWkQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=orDaycaqaeU:KThfEaGXWkQ:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/orDaycaqaeU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/12/configuring-multiple-build-agent-for-tfs-2010-in-workgroup-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/12/configuring-multiple-build-agent-for-tfs-2010-in-workgroup-environment/</feedburner:origLink></item>
		<item>
		<title>Aop With castle – Part 2 – Selecting methods to intercept</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/Rn9j5urOPO0/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/08/aop-with-castle-part-2-selecting-methods-to-intercept/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 14:59:29 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Castle]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/08/aop-with-castle-part-2-selecting-methods-to-intercept/</guid>
		<description><![CDATA[
			
				
			
		
Previous Part of the series 
Part 1 – The basic of interception
Some people, after looking at interceptor concept, are not fully convinced that castle can support all concepts of AOP and the first question usually is: “How can I choose witch method intercept, instead of intercepting calls to all methods, and how can I configure [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F08%2Faop-with-castle-part-2-selecting-methods-to-intercept%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F08%2Faop-with-castle-part-2-selecting-methods-to-intercept%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Previous Part of the series </p>
<p><a href="http://www.codewrecks.com/blog/index.php/2010/06/01/aop-with-castle-part-1/">Part 1 – The basic of interception</a></p>
<p>Some people, after looking at interceptor concept, are not fully convinced that castle can support all concepts of AOP and the first question usually is: “How can I choose witch method intercept, instead of intercepting calls to all methods, and how can I configure this with XML file or fluent configuration?”. This answer can have various solutions, but in my opinion the simplest one is doing a little manual logic on interceptor.</p>
<p>Since the interceptor is resolved by castle it is possible to add a list of valid regular expressions used to select methods to intercept, and simply check the method name to decide if it needs to be intercepted. This approach is the most simple one because it is based only on the basic structure of castle, and it has the advantages of change the list of methods to intercept simply changing the configuration of the interceptor. You can put this code on an interceptor or create a base interceptor class that contains the base logic.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> BetterDumpInterceptor : IInterceptor</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> List&lt;String&gt; RegexSelector { <span style="color: #0000ff">get</span>; <span style="color: #0000ff">set</span>; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     <span style="color: #0000ff">public</span> void Intercept(IInvocation invocation)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         <span style="color: #0000ff">if</span> (!CanIntercept(invocation)) {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>             invocation.Proceed();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>             <span style="color: #0000ff">return</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         }</pre>
<p><!--CRLF--></div>
</div>
<p>This is a simple example on how you can filter method to intercept, the CanIntercept() can be implemented in this way.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> private <span style="color: #0000ff">Boolean</span> CanIntercept(IInvocation invocation)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">if</span> (RegexSelector == <span style="color: #0000ff">null</span> || RegexSelector.<span style="color: #0000ff">Count</span> == 0) <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     foreach (var regex <span style="color: #0000ff">in</span> RegexSelector)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         <span style="color: #0000ff">if</span> (Regex.IsMatch(invocation.Method.Name, regex))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>             <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>The only modification is during registration, because now you need to specify the list of regexes to identify methods that needs to be intercepted</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> container.Register(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     Component.<span style="color: #0000ff">For</span>&lt;IInterceptor&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     .ImplementedBy&lt;BetterDumpInterceptor&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     .Named(&quot;myinterceptor&quot;)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     .DependsOn(Property.ForKey(&quot;RegexSelector&quot;).Eq(<span style="color: #0000ff">new</span> List&lt;String&gt;() { &quot;DoSomething&quot; })));</pre>
<p><!--CRLF--></div>
</div>
<p>This is really a simple solution, and you can verify from the output that only selected methods are intercepted.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image16.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb16.png" width="560" height="213" /></a> </p>
<p>In red I highlighted the calls to regex.Match(), and since they are a little bit expensive, to speedup execution we can add caching using a dictionary, to store result of methods already scanned, just to avoid using too much regex at each call; the basic concept is always the same:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> BetterDumpInterceptor : IInterceptor</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> List&lt;String&gt; RegexSelector { <span style="color: #0000ff">get</span>; <span style="color: #0000ff">set</span>; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     private <span style="color: #0000ff">Dictionary</span>&lt;RuntimeMethodHandle, <span style="color: #0000ff">Boolean</span>&gt; _scanned</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         = <span style="color: #0000ff">new</span> <span style="color: #0000ff">Dictionary</span>&lt;RuntimeMethodHandle, bool&gt;();</pre>
<p><!--CRLF--></div>
</div>
<p>I stored the result of the CanIntercept directly in a dictionary, and I use RuntimeMethodHandle just to save a little bit of memory not storing the full MethodInfo object. Then I modify the CanIntercept function in this way.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> private <span style="color: #0000ff">Boolean</span> CanIntercept(IInvocation invocation)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">if</span> (!_scanned.ContainsKey(invocation.Method.MethodHandle))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         <span style="color: #0000ff">if</span> (RegexSelector == <span style="color: #0000ff">null</span> || RegexSelector.<span style="color: #0000ff">Count</span> == 0) <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>         foreach (var regex <span style="color: #0000ff">in</span> RegexSelector)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>             <span style="color: #0000ff">if</span> (Regex.IsMatch(invocation.Method.Name, regex))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>                 _scanned[invocation.Method.MethodHandle] = <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>                 <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>         _scanned[invocation.Method.MethodHandle] = <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     <span style="color: #0000ff">return</span> _scanned[invocation.Method.MethodHandle];</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Now the same configuration produces this output.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image17.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb17.png" width="551" height="184" /></a> </p>
<p>As you can see the regex are called only for the first call of a method, each subsequent calls does not requires Regex.Match anymore.</p>
<p>And with this little trick I simply end with an interceptor that permits to select methods you want to intercept with configuration.</p>
<p>If you do not like doing this manually, Castle offers a native way to decide which method to intercept, based on the interface IInterceptorSelector, that contains a single method with this signature.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> IInterceptor[] SelectInterceptors(Type type, System.Reflection.MethodInfo method, IInterceptor[] interceptors)</pre>
<p><!--CRLF--></div>
</div>
<p>Basically it receives the Type and MethodInfo for the method being called, and a list of interceptors configured for that method, the purpose of the selector is to return an array containing only the interceptors that are allowed to be used on that method. A possible implementation is the following one.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">Dictionary</span>&lt;Type, List&lt;String&gt;&gt; RegexSelector { <span style="color: #0000ff">get</span>; <span style="color: #0000ff">set</span>; }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">public</span> InterceptorSelector(<span style="color: #0000ff">Dictionary</span>&lt;Type, List&lt;string&gt;&gt; regexSelector)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     RegexSelector = regexSelector;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> private <span style="color: #0000ff">Boolean</span> CanIntercept(MethodInfo methodInfo, IInterceptor interceptor)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     List&lt;String&gt; regexForInterceptor;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     <span style="color: #0000ff">if</span> (!RegexSelector.TryGetValue(interceptor.GetType(), <span style="color: #0000ff">out</span> regexForInterceptor))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     <span style="color: #0000ff">if</span> (regexForInterceptor == <span style="color: #0000ff">null</span>) <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     foreach (var regex <span style="color: #0000ff">in</span> regexForInterceptor)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>         <span style="color: #0000ff">if</span> (Regex.IsMatch(methodInfo.Name, regex))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>             <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>     <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span> #region IInterceptorSelector Members</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span> <span style="color: #0000ff">public</span> IInterceptor[] SelectInterceptors(Type type, System.Reflection.MethodInfo method, IInterceptor[] interceptors)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>     Utils.ConsoleWriteline(ConsoleColor.Red, &quot;Called interceptor selector <span style="color: #0000ff">for</span> method {0}.{1} <span style="color: #0000ff">and</span> interceptors {2}&quot;,</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>         type.FullName,</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>         method.Name,</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>         interceptors</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>         .<span style="color: #0000ff">Select</span>(i =&gt; i.GetType().Name)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>         .<span style="color: #0000ff">Aggregate</span>((s1, s2) =&gt; s1 + &quot; &quot; + s2));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>     <span style="color: #0000ff">return</span> interceptors.<span style="color: #0000ff">Where</span>(i =&gt; CanIntercept(method, i)).ToArray();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span> #endregion</pre>
<p><!--CRLF--></div>
</div>
<p>This selector contains a dictionary of Type and List&lt;String&gt;, basically for each interceptor type it contains a list of regex to identify methods to be intercepted. The rest of the selector is really simple, with a little bit of LINQ we can select only the interceptors that are in the dictionary and have at least one match with the method name. You can use it in this way.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">Dictionary</span>&lt;Type, List&lt;String&gt;&gt; RegexSelector = <span style="color: #0000ff">new</span> <span style="color: #0000ff">Dictionary</span>&lt;Type, List&lt;string&gt;&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> RegexSelector.<span style="color: #0000ff">Add</span>(typeof(DumpInterceptor), <span style="color: #0000ff">new</span> List&lt;string&gt;() { &quot;DoSomething&quot; });</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> RegexSelector.<span style="color: #0000ff">Add</span>(typeof(LogInterceptor), <span style="color: #0000ff">new</span> List&lt;string&gt;() { &quot;Augment&quot; });</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> InterceptorSelector selector = <span style="color: #0000ff">new</span> InterceptorSelector(RegexSelector);</pre>
<p><!--CRLF--></div>
</div>
<p>I created a selector that permits to select a couple of interceptors, one is the DumpInterceptor, and I want it to intercept the “DoSomething” method, while the LogInterceptor should intercept only the “Augment” method. Once the selector is configured you can simply use it in fluent configuration.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> container.Register(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>    Component.<span style="color: #0000ff">For</span>&lt;IInterceptor&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>    .ImplementedBy&lt;DumpInterceptor&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>    .Named(&quot;DumpInterceptor&quot;));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> container.Register(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>    Component.<span style="color: #0000ff">For</span>&lt;IInterceptor&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>    .ImplementedBy&lt;LogInterceptor&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>    .Named(&quot;LogInterceptor&quot;));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> container.Register(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     Component.<span style="color: #0000ff">For</span>&lt;ISomething&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>     .ImplementedBy&lt;Something&gt;()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     .Interceptors(</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>          InterceptorReference.ForKey(&quot;DumpInterceptor&quot;),</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>          InterceptorReference.ForKey(&quot;LogInterceptor&quot;))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>          .SelectedWith(selector).Anywhere);</pre>
<p><!--CRLF--></div>
</div>
<p>Now you can run the program and look at the output.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image18.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb18.png" width="647" height="299" /></a> </p>
<p>With red color I highlight the calls to the SelectInterceptors method, and you can immediately see that Castle does caching internally and does not call the SelectInterceptors() method more than once for each method, so we does not need to cache stuff. As you can see from the output the result is the one I expect, dumpInterceptor is intercepting only the method DoSomething while the LogInterceptor intercepts only the Augment.</p>
<p>You can use the approach you prefer .</p>
<p>Alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/KIpH1pLQV4-jEgVvqJiTt2kHpKQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/KIpH1pLQV4-jEgVvqJiTt2kHpKQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KIpH1pLQV4-jEgVvqJiTt2kHpKQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/KIpH1pLQV4-jEgVvqJiTt2kHpKQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Rn9j5urOPO0:In2PiY5pjgQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Rn9j5urOPO0:In2PiY5pjgQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Rn9j5urOPO0:In2PiY5pjgQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=Rn9j5urOPO0:In2PiY5pjgQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Rn9j5urOPO0:In2PiY5pjgQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=Rn9j5urOPO0:In2PiY5pjgQ:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/Rn9j5urOPO0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/08/aop-with-castle-part-2-selecting-methods-to-intercept/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/08/aop-with-castle-part-2-selecting-methods-to-intercept/</feedburner:origLink></item>
		<item>
		<title>Event 1006 Distributed Com</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/zDhtt071mjM/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/08/event-1006-distributed-com/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 08:15:19 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/08/event-1006-distributed-com/</guid>
		<description><![CDATA[
			
				
			
		
In a Tfs Test machine I have I see that there are error in the System log
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {&#60;CLSID&#62;} to the user &#60;user&#62; SID (&#60;SID&#62;). This security permission can be modified using the Component Services administrative tool.

To solve this problem [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F08%2Fevent-1006-distributed-com%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F08%2Fevent-1006-distributed-com%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In a Tfs Test machine I have I see that there are error in the System log</p>
<blockquote><p>The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID {&lt;CLSID&gt;} to the user &lt;user&gt; SID (&lt;SID&gt;). This security permission can be modified using the Component Services administrative tool.</p>
</blockquote>
<p>To solve this problem simply open “Component Services” tool, expand the Computers/MyComputer/DCOMConfig, then locate the entry with the CLSID you find in the message, then right click and select property</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image13.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb13.png" width="608" height="295" /></a> </p>
<p>This will open a property windows, you need to locate the Security Tab, and customize the “Launch and Activation Permissions”</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image14.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb14.png" width="410" height="191" /></a> </p>
<p>From here add to the user the required security permission and the Error Log should not appears anymore.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image15.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb15.png" width="244" height="234" /></a> </p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/utspTpp9SIzBp_Ck56mFa8Yypus/0/da"><img src="http://feedads.g.doubleclick.net/~a/utspTpp9SIzBp_Ck56mFa8Yypus/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/utspTpp9SIzBp_Ck56mFa8Yypus/1/da"><img src="http://feedads.g.doubleclick.net/~a/utspTpp9SIzBp_Ck56mFa8Yypus/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=zDhtt071mjM:a642GaCLbWc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=zDhtt071mjM:a642GaCLbWc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=zDhtt071mjM:a642GaCLbWc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=zDhtt071mjM:a642GaCLbWc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=zDhtt071mjM:a642GaCLbWc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=zDhtt071mjM:a642GaCLbWc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/zDhtt071mjM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/08/event-1006-distributed-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/08/event-1006-distributed-com/</feedburner:origLink></item>
		<item>
		<title>Repair Visual Studio template</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/y4JQ19XOjTo/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 17:12:17 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/</guid>
		<description><![CDATA[
			
				
			
		
Some minutes ago I installed Expression studio 4.0, while I’m working with a couple of solution in VS2008, when I close the solution and open another solution I see that I was not able anymore to work with test projects.
All test projects inside any solution appear as folder, and I was not able anymore to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F07%2Frepair-visual-studio-template%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F07%2Frepair-visual-studio-template%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Some minutes ago I installed Expression studio 4.0, while I’m working with a couple of solution in VS2008, when I close the solution and open another solution I see that I was not able anymore to work with test projects.</p>
<p>All test projects inside any solution appear as folder, and I was not able anymore to create a test project. I do not know if something get wrong during installation of Expression tools while I have a couple of VS instances opened or there was some problem on my machine that happened for any other reason <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , but whenever you got problem with project templates in Visual Studio, such as missing project types, you can try to run </p>
<p><strong><em>devenv /InstallVSTemplates</em></strong></p>
<p>that restores all templates in Visual Studio, it worked for me <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/bTpsCj0i0XghhU78a0skG2OiB5o/0/da"><img src="http://feedads.g.doubleclick.net/~a/bTpsCj0i0XghhU78a0skG2OiB5o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/bTpsCj0i0XghhU78a0skG2OiB5o/1/da"><img src="http://feedads.g.doubleclick.net/~a/bTpsCj0i0XghhU78a0skG2OiB5o/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=y4JQ19XOjTo:nBk4A_NpFQU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=y4JQ19XOjTo:nBk4A_NpFQU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=y4JQ19XOjTo:nBk4A_NpFQU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=y4JQ19XOjTo:nBk4A_NpFQU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=y4JQ19XOjTo:nBk4A_NpFQU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=y4JQ19XOjTo:nBk4A_NpFQU:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/y4JQ19XOjTo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/</feedburner:origLink></item>
		<item>
		<title>Create web deploy package during a tfs 2010 build</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/sEH2Xx-ydUQ/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/07/create-web-deploy-package-during-a-tfs-2010-build/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 15:48:53 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[TFS Build]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/07/create-web-deploy-package-during-a-tfs-2010-build/</guid>
		<description><![CDATA[
			
				
			
		
Web projects in VS2010 has a great flexibility when it is time to deploy to the server, and it has a great option to generate a Deploy Package with a single click
 
But if you build a web project with a tfs2010 build you can verify that in the drop folder you simply have the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F07%2Fcreate-web-deploy-package-during-a-tfs-2010-build%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F07%2Fcreate-web-deploy-package-during-a-tfs-2010-build%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Web projects in VS2010 has a great flexibility when it is time to deploy to the server, and it has a great option to generate a Deploy Package with a single click</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb8.png" width="624" height="291" /></a> </p>
<p>But if you build a web project with a tfs2010 build you can verify that in the drop folder you simply have the published web site that contains only all the files, and not package to install </p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb9.png" width="396" height="143" /></a> </p>
<p>To generate the deploy package during a build you need to set to true a couple of msbuild properties</p>
<p><em><strong>/p:CreatePackageOnPublish=true /p:DeployOnBuild=true</strong></em></p>
<p>These two properties ask to MSBuild to generate the build deployment package during the build. You can put them in the MSBuild Arguments part of the build definition, it is really simple</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb10.png" width="665" height="280" /></a> </p>
<p>If you run this build, you can verify from msbuild log that the package was generated.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image11.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb11.png" width="777" height="182" /></a> </p>
<p>The good part is that if you look at the drop folder you can notice that the build automatically copied the Package into the output.</p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image12.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/06/image_thumb12.png" width="386" height="179" /></a> </p>
<p>This is good because you will end with an installable web site always available in the drop folder.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/3gYQ1POQDxOXdtySydYDxZcDfDQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/3gYQ1POQDxOXdtySydYDxZcDfDQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3gYQ1POQDxOXdtySydYDxZcDfDQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/3gYQ1POQDxOXdtySydYDxZcDfDQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=sEH2Xx-ydUQ:vgkBmJSGX3g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=sEH2Xx-ydUQ:vgkBmJSGX3g:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=sEH2Xx-ydUQ:vgkBmJSGX3g:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=sEH2Xx-ydUQ:vgkBmJSGX3g:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=sEH2Xx-ydUQ:vgkBmJSGX3g:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=sEH2Xx-ydUQ:vgkBmJSGX3g:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/sEH2Xx-ydUQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/07/create-web-deploy-package-during-a-tfs-2010-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/07/create-web-deploy-package-during-a-tfs-2010-build/</feedburner:origLink></item>
		<item>
		<title>NHibernate HQL query with only date part of a datetimevalue</title>
		<link>http://feedproxy.google.com/~r/AlkampferEng/~3/j_Y9MMQnjGY/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/04/nhibernate-hql-query-with-only-date-part-of-a-datetimevalue/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 12:54:24 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Nhibernate]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/04/nhibernate-hql-query-with-only-date-part-of-a-datetimevalue/</guid>
		<description><![CDATA[
			
				
			
		
DateTime values are one of the most feared type of data to store in database. Suppose you have an entity with a datetime Property, and you want to do a standard report finding the count of each entity for each day in a date range, if you groupBy the DateTime property, surely you will get [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F04%2Fnhibernate-hql-query-with-only-date-part-of-a-datetimevalue%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F04%2Fnhibernate-hql-query-with-only-date-part-of-a-datetimevalue%2F&amp;source=alkampfer&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>DateTime values are one of the most feared type of data to store in database. Suppose you have an entity with a datetime Property, and you want to do a standard report finding the count of each entity for each day in a date range, if you groupBy the DateTime property, surely you will get wrong results, because you will end with a lot of entries with count = 1, because it is really difficult that two entities will have the very same datetime value. What you want is to group by only with the date part of the datetime property.</p>
<p>Since NHibernate does not come with a predefined date function, you need to create a custom dialect to solve the problem, first of all I have a custom dialect for my SqlLite unit tests.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> SqlLiteDialect : NHibernate.Dialect.SQLiteDialect</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> SqlLiteDialect()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         RegisterFunction(<span style="color: #006080">&quot;date&quot;</span>, <span style="color: #0000ff">new</span> SQLFunctionTemplate(NHibernateUtil.Date, <span style="color: #006080">&quot;date(?1)&quot;</span>));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Since SqlLite already have a <a target="_blank" href="http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions">date function</a> that extract the date part of a date, I simply need to instruct NHibernate dialect that such function exists registering the function “date” with a SqlFunctionTemplate, this means that whenever the HQL parser will find a call to date() function it will substitute the date(?1) string, where ?1 will be substituted with the real parameter of the function.</p>
<p>In production, the code will run against a sql server 2008, and we have already defined a function called dbo.trunc that will truncate the time part of the date in our databases, so I create a similar dialect for sql server.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> MySqlDialect : NHibernate.Dialect.MsSql2008Dialect</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">public</span> MySqlDialect ()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         RegisterFunction(<span style="color: #006080">&quot;date&quot;</span>, <span style="color: #0000ff">new</span> SQLFunctionTemplate(NHibernateUtil.Date, <span style="color: #006080">&quot;dbo.trunc(?1)&quot;</span>));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>The great advantage of the dialect approach, is that you are able to write a hql query like this:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">Select</span> <span style="color: #0000ff">date</span>(A.ActionDate), <span style="color: #0000ff">count</span>(*) </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">from</span> <span style="color: #0000ff">Action</span> A </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">where</span> A.ActionDate &gt;= :startdate <span style="color: #0000ff">and</span> A.ActionDate &lt;= :enddate</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">group</span> <span style="color: #0000ff">by</span> <span style="color: #0000ff">date</span>(A.ActionDate)</pre>
<p><!--CRLF--></div>
</div>
<p>Where I’m able to use date() function, but at the same time it gets translated in different way respect the dialect I use. If in the future I will need to use Oracle, I’ll simply create another dialect, without the need to modify any HQL query.</p>
<p>alk.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/LE4iVDaC2C7ebB_WTclhUiD2vXg/0/da"><img src="http://feedads.g.doubleclick.net/~a/LE4iVDaC2C7ebB_WTclhUiD2vXg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LE4iVDaC2C7ebB_WTclhUiD2vXg/1/da"><img src="http://feedads.g.doubleclick.net/~a/LE4iVDaC2C7ebB_WTclhUiD2vXg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=j_Y9MMQnjGY:fD_BPk6YPVU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=j_Y9MMQnjGY:fD_BPk6YPVU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=j_Y9MMQnjGY:fD_BPk6YPVU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?i=j_Y9MMQnjGY:fD_BPk6YPVU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=j_Y9MMQnjGY:fD_BPk6YPVU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/AlkampferEng?a=j_Y9MMQnjGY:fD_BPk6YPVU:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/AlkampferEng?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/AlkampferEng/~4/j_Y9MMQnjGY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/04/nhibernate-hql-query-with-only-date-part-of-a-datetimevalue/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.codewrecks.com/blog/index.php/2010/06/04/nhibernate-hql-query-with-only-date-part-of-a-datetimevalue/</feedburner:origLink></item>
	</channel>
</rss>
