<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>The Old Sewing Factory</title>
	<atom:link href="http://theoldsewingfactory.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://theoldsewingfactory.com</link>
	<description>No more than my online scratch pad.</description>
	<lastBuildDate>Sun, 13 May 2012 15:42:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CSS Border Radius Generator</title>
		<link>http://theoldsewingfactory.com/2012/01/19/css-border-radius-generator/</link>
		<comments>http://theoldsewingfactory.com/2012/01/19/css-border-radius-generator/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 22:12:51 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=283</guid>
		<description><![CDATA[I just stumbled across this really handy CSS round corner tool. It isn&#8217;t magic, but it&#8217;s a simple tool that just works. Enjoy. CSS Border Radius Generator]]></description>
			<content:encoded><![CDATA[<p>I just stumbled across this really handy CSS round corner tool. It isn&#8217;t magic, but it&#8217;s a simple tool that just works. Enjoy. </p>
<p><a href='http://border-radius.com/'>CSS Border Radius Generator</a></p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2012/01/19/css-border-radius-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are you Learning C#?</title>
		<link>http://theoldsewingfactory.com/2011/10/18/are-you-learning-c/</link>
		<comments>http://theoldsewingfactory.com/2011/10/18/are-you-learning-c/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 12:00:38 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C# Yellow Book]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=278</guid>
		<description><![CDATA[If you&#8217;re learning C# you won&#8217;t go much wrong with the C# Yellow book. Rob Miles has just released a new version. This year&#8217;s copy is a minor release, of a sort. It&#8217;s mostly a couple of corrections to last years content. If you&#8217;re starting out with programming or programming C# then you really should [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re learning C# you won&#8217;t go much wrong with the C# Yellow book. Rob Miles has just released a new version. This year&#8217;s copy is a minor release, of a sort. It&#8217;s mostly a couple of corrections to last years content. If you&#8217;re starting out with programming or programming C# then you really should take a look: <a href="http://www.robmiles.com/journal/2011/10/13/c-yellow-book-2011.html" title="C# Yellow Book">http://www.robmiles.com/journal/2011/10/13/c-yellow-book-2011.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/10/18/are-you-learning-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic Robots.txt in ASP MVC</title>
		<link>http://theoldsewingfactory.com/2011/10/17/dynamic-robots-txt-in-asp-mvc/</link>
		<comments>http://theoldsewingfactory.com/2011/10/17/dynamic-robots-txt-in-asp-mvc/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 20:29:54 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[asp net mvc]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[robots.txt]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=272</guid>
		<description><![CDATA[I recently had the need to switch a robots.txt file dynamically, depending on whether a site was deployed to live or beta servers. The solution was very simple, ditch the real file and replace it with a controller action. This is a brief note on how I did this. I don&#8217;t pretend this is an [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the need to switch a robots.txt file dynamically, depending on whether a site was deployed to live or beta servers. The solution was very simple, ditch the real file and replace it with a controller action. This is a brief note on how I did this. I don&#8217;t pretend this is an ideal solution, it was something I knocked together before I went out for dinner.</p>
<p>The solution I went for was in three parts: a web.config transform, routing and the controller itself.</p>
<p>The web config transform for my live site looks like this:</p>
<div id="gist-1293678" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'>&lt;?xml version=&quot;1.0&quot;?&gt;</div><div class='line' id='LC2'>&lt;configuration xmlns:xdt=&quot;http://schemas.microsoft.com/XML-Document-Transform&quot;&gt;</div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;&lt;appSettings&gt;</div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add key=&quot;SiteStatus&quot; value=&quot;live&quot; xdt:Transform=&quot;SetAttributes&quot; xdt:Locator=&quot;Match(key)&quot;/&gt;</div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/appSettings&gt;</div><div class='line' id='LC6'>&lt;/configuration&gt;</div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1293678/10b0679d29c76d293d5a9674a999c92d203f78ce/Web.live.config" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1293678#file_web.live.config" style="float:right;margin-right:10px;color:#666">Web.live.config</a>
            <a href="https://gist.github.com/1293678">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The route is equally simple:</p>
<div id="gist-1293683" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">routes</span><span class="p">.</span><span class="n">MapRoute</span><span class="p">(</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;Robots.txt&quot;</span><span class="p">,</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;Robots.txt&quot;</span><span class="p">,</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">new</span> </div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span> </div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">controller</span> <span class="p">=</span> <span class="s">&quot;Robots&quot;</span><span class="p">,</span> </div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">action</span> <span class="p">=</span> <span class="s">&quot;RobotsText&quot;</span> </div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC9'><span class="p">);</span></div><div class='line' id='LC10'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1293683/99572e2905fc1ae70938a50fcdb599d5bc3aaa5c/routing.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1293683#file_routing.cs" style="float:right;margin-right:10px;color:#666">routing.cs</a>
            <a href="https://gist.github.com/1293683">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>And finally the actual controller:</p>
<div id="gist-1293645" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">public</span> <span class="k">class</span> <span class="nc">RobotsController</span> <span class="p">:</span> <span class="n">Controller</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="n">FileContentResult</span> <span class="nf">RobotsText</span><span class="p">()</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">var</span> <span class="n">content</span> <span class="p">=</span> <span class="s">&quot;User-agent: *&quot;</span> <span class="p">+</span> <span class="n">Environment</span><span class="p">.</span><span class="n">NewLine</span><span class="p">;</span></div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">Equals</span><span class="p">(</span><span class="n">ConfigurationManager</span><span class="p">.</span><span class="n">AppSettings</span><span class="p">[</span><span class="s">&quot;SiteStatus&quot;</span><span class="p">],</span> <span class="s">&quot;live&quot;</span><span class="p">,</span> <span class="n">StringComparison</span><span class="p">.</span><span class="n">InvariantCultureIgnoreCase</span><span class="p">))</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">content</span> <span class="p">+=</span> <span class="s">&quot;Disallow: /elmah.axd&quot;</span> <span class="p">+</span> <span class="n">Environment</span><span class="p">.</span><span class="n">NewLine</span><span class="p">;</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">content</span> <span class="p">+=</span> <span class="s">&quot;Sitemap: http://www.jacquelinewhite.co.uk/sitemap.xml&quot;</span><span class="p">;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">content</span> <span class="p">+=</span> <span class="s">&quot;Disallow: /&quot;</span> <span class="p">+</span> <span class="n">Environment</span><span class="p">.</span><span class="n">NewLine</span><span class="p">;</span> </div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nf">File</span><span class="p">(</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Encoding</span><span class="p">.</span><span class="n">UTF8</span><span class="p">.</span><span class="n">GetBytes</span><span class="p">(</span><span class="n">content</span><span class="p">),</span></div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="s">&quot;text/plain&quot;</span><span class="p">);</span> </div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC21'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1293645/bbcec14b69fabc9ee4fd147cd0f37b8c267da3df/RobotsController.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1293645#file_robots_controller.cs" style="float:right;margin-right:10px;color:#666">RobotsController.cs</a>
            <a href="https://gist.github.com/1293645">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>And there we have it, my robots.txt file now is customised on a per deployment basis.</p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/10/17/dynamic-robots-txt-in-asp-mvc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Better Guard Class</title>
		<link>http://theoldsewingfactory.com/2011/10/10/a-better-guard-class/</link>
		<comments>http://theoldsewingfactory.com/2011/10/10/a-better-guard-class/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 16:20:19 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=256</guid>
		<description><![CDATA[Recently I was working with some of the developers in a different office, I don&#8217;t normally see their code, so it was interesting to see how they are meeting various problems. Generally speaking, they are doing some nice looking work. The architecture that they are moving towards looks like it&#8217;s going a long way to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working with some of the developers in a different office, I don&#8217;t normally see their code, so it was interesting to see how they are meeting various problems. Generally speaking, they are doing some nice looking work. The architecture that they are moving towards looks like it&#8217;s going a long way to solving a lot of problems, all good stuff.</p>
<p>One bit of code that I kept seeing really bothered me. It was a guard class that I kept seeing. I think it was a clone of a class from the <a href="https://gist.github.com/ayende/rhino-etl/blob/master/Rhino.Etl.Core/Guard.cs" title="Guard.cs" target="_blank">here</a>. The reason it bothered me was simply that it didn&#8217;t read well, I kept thinking that it was guarding against an exception. In reality it was guarding against an error condition and would throw an exception if the condition happened. For example:</p>
<div id="gist-1273821" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">Guard</span><span class="p">.</span><span class="n">Against</span><span class="p">&lt;</span><span class="n">InvalidOperationException</span><span class="p">&gt;(</span><span class="kt">string</span><span class="p">.</span><span class="n">IsNullOrEmpty</span><span class="p">(</span><span class="n">serverName</span><span class="p">),</span> <span class="s">&quot;Server name must be provided&quot;</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1273821/01377ddf2303e04a59c5f2c581621ad633d3c907/GuardExample.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1273821#file_guard_example.cs" style="float:right;margin-right:10px;color:#666">GuardExample.cs</a>
            <a href="https://gist.github.com/1273821">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>I would much rather something that reads like this:</p>
<div id="gist-1273854" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">Throw</span><span class="p">&lt;</span><span class="n">InvalidOperationException</span><span class="p">&gt;</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">.</span><span class="n">WithMessage</span><span class="p">(</span><span class="s">&quot;Server name must be provided&quot;</span><span class="p">)</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">.</span><span class="n">When</span><span class="p">(</span><span class="kt">string</span><span class="p">.</span><span class="n">IsNullOrEmpty</span><span class="p">(</span><span class="n">serverName</span><span class="p">));</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1273854/464c028a4687f92f58dd5739c8c28a825aa453d2/ThrowExample.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1273854#file_throw_example.cs" style="float:right;margin-right:10px;color:#666">ThrowExample.cs</a>
            <a href="https://gist.github.com/1273854">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Here&#8217;s my implementation of the class, thoughts?</p>
<div id="gist-1273783" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">public</span> <span class="k">static</span> <span class="k">class</span> <span class="nc">Throw</span><span class="p">&lt;</span><span class="n">T</span><span class="p">&gt;</span> <span class="k">where</span> <span class="n">T</span> <span class="p">:</span> <span class="n">Exception</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">static</span> <span class="n">Thrower</span> <span class="nf">WithMessage</span><span class="p">(</span><span class="kt">string</span> <span class="n">message</span><span class="p">)</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="k">new</span> <span class="nf">Thrower</span><span class="p">(</span><span class="n">message</span><span class="p">);</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">class</span> <span class="nc">Thrower</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">private</span> <span class="k">readonly</span> <span class="kt">string</span> <span class="n">message</span><span class="p">;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="nf">Thrower</span><span class="p">(</span><span class="kt">string</span> <span class="n">message</span><span class="p">)</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">this</span><span class="p">.</span><span class="n">message</span> <span class="p">=</span> <span class="n">message</span><span class="p">;</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">void</span> <span class="nf">When</span><span class="p">(</span><span class="n">Func</span><span class="p">&lt;</span><span class="kt">bool</span><span class="p">&gt;</span> <span class="n">predicate</span><span class="p">)</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">predicate</span><span class="p">())</span></div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">throw</span> <span class="p">(</span><span class="n">T</span><span class="p">)</span><span class="n">Activator</span><span class="p">.</span><span class="n">CreateInstance</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="n">T</span><span class="p">),</span> <span class="n">message</span><span class="p">);</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC22'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">void</span> <span class="nf">When</span><span class="p">(</span><span class="kt">bool</span> <span class="n">condition</span><span class="p">)</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">condition</span><span class="p">)</span></div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC28'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">throw</span> <span class="p">(</span><span class="n">T</span><span class="p">)</span><span class="n">Activator</span><span class="p">.</span><span class="n">CreateInstance</span><span class="p">(</span><span class="k">typeof</span><span class="p">(</span><span class="n">T</span><span class="p">),</span> <span class="n">message</span><span class="p">);</span></div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC32'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1273783/60785207fc98c1a4b5acbe4250e2cf3cf87fd0a8/Throw.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1273783#file_throw.cs" style="float:right;margin-right:10px;color:#666">Throw.cs</a>
            <a href="https://gist.github.com/1273783">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/10/10/a-better-guard-class/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Handling Google Instant in ASP MVC</title>
		<link>http://theoldsewingfactory.com/2011/05/28/handling-google-instant-in-asp-mvc/</link>
		<comments>http://theoldsewingfactory.com/2011/05/28/handling-google-instant-in-asp-mvc/#comments</comments>
		<pubDate>Sat, 28 May 2011 18:32:48 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[asp net mvc]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=247</guid>
		<description><![CDATA[I love google chrome, it&#8217;s how browsers should be, it just works. The one thing I really like about it is the instant setting. The problem is that most sites don&#8217;t really know the difference between a bad url and a url that is being typed. Well, now you can and it&#8217;s really simple. The [...]]]></description>
			<content:encoded><![CDATA[<p>I love google chrome, it&#8217;s how browsers should be, it just works. The one thing I really like about it is the instant setting. The problem is that most sites don&#8217;t really know the difference between a bad url and a url that is being typed.</p>
<p>Well, now you can and it&#8217;s really simple.</p>
<p>The following extension method will let your controller know if it&#8217;s a full request or simply a user busy typing:</p>
<div id="gist-997098" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">public</span> <span class="k">static</span> <span class="k">class</span> <span class="nc">RequestExtensions</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">public</span> <span class="k">static</span> <span class="kt">bool</span> <span class="nf">IsPreview</span><span class="p">(</span><span class="k">this</span> <span class="n">HttpRequestBase</span> <span class="n">request</span><span class="p">)</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">var</span> <span class="n">purpose</span> <span class="p">=</span> <span class="n">request</span><span class="p">.</span><span class="n">Headers</span><span class="p">[</span><span class="s">&quot;X-Purpose&quot;</span><span class="p">]</span> <span class="p">??</span> <span class="kt">string</span><span class="p">.</span><span class="n">Empty</span><span class="p">;</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="kt">string</span><span class="p">.</span><span class="n">Equals</span><span class="p">(</span><span class="s">&quot;: preview&quot;</span><span class="p">,</span> <span class="n">purpose</span><span class="p">,</span> <span class="n">StringComparison</span><span class="p">.</span><span class="n">InvariantCultureIgnoreCase</span><span class="p">);</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC8'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/997098/9d179b38dd01c096dbc6972d07269d6ddd5ef8cb/gistfile1.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/997098#file_gistfile1.cs" style="float:right;margin-right:10px;color:#666">gistfile1.cs</a>
            <a href="https://gist.github.com/997098">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>A very simple use of it would be something like this:</p>
<div id="gist-997103" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">public</span> <span class="k">virtual</span> <span class="n">ActionResult</span> <span class="nf">Error404</span><span class="p">()</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">Response</span><span class="p">.</span><span class="n">StatusCode</span> <span class="p">=</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">HttpStatusCode</span><span class="p">.</span><span class="n">NotFound</span><span class="p">;</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">Request</span><span class="p">.</span><span class="n">IsPreview</span><span class="p">())</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ViewBag</span><span class="p">.</span><span class="n">Message</span> <span class="p">=</span> <span class="s">&quot;Nope, I&#39;ve haven&#39;t go that, keep typing.&quot;</span><span class="p">;</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ViewBag</span><span class="p">.</span><span class="n">Message</span> <span class="p">=</span> <span class="s">&quot;Sorry, but the file you requested was not found on the server.&quot;</span><span class="p">;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="nf">View</span><span class="p">();</span></div><div class='line' id='LC14'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/997103/91b132909c416dad2643886cf36e3a1bb16b0c83/gistfile1.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/997103#file_gistfile1.cs" style="float:right;margin-right:10px;color:#666">gistfile1.cs</a>
            <a href="https://gist.github.com/997103">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Let me know if you use this is a more creative way.</p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/05/28/handling-google-instant-in-asp-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encrypt Connection Strings on Application Startup</title>
		<link>http://theoldsewingfactory.com/2011/05/18/encrypt-connection-strings-on-application-startup/</link>
		<comments>http://theoldsewingfactory.com/2011/05/18/encrypt-connection-strings-on-application-startup/#comments</comments>
		<pubDate>Wed, 18 May 2011 17:30:32 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=244</guid>
		<description><![CDATA[Just so I don&#8217;t forget how I do this:]]></description>
			<content:encoded><![CDATA[<p>Just so I don&#8217;t forget how I do this:</p>
<div id="gist-977568" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">protected</span> <span class="k">void</span> <span class="nf">Application_Start</span><span class="p">()</span></div><div class='line' id='LC2'><span class="p">{</span></div><div class='line' id='LC3'><span class="cp">#if !DEBUG</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">EncryptConnectionStrings</span><span class="p">();</span></div><div class='line' id='LC5'><span class="cp">#endif</span></div><div class='line' id='LC6'><span class="p">}</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="k">private</span> <span class="k">void</span> <span class="nf">EncryptConnectionStrings</span><span class="p">()</span></div><div class='line' id='LC9'><span class="p">{</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">var</span> <span class="n">sectionName</span> <span class="p">=</span> <span class="s">&quot;connectionStrings&quot;</span><span class="p">;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kt">var</span> <span class="n">config</span> <span class="p">=</span> <span class="n">WebConfigurationManager</span><span class="p">.</span><span class="n">OpenWebConfiguration</span><span class="p">(</span><span class="s">&quot;~&quot;</span><span class="p">);</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">ConfigurationSection</span> <span class="n">section</span> <span class="p">=</span> <span class="n">config</span><span class="p">.</span><span class="n">GetSection</span><span class="p">(</span><span class="n">sectionName</span><span class="p">);</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="p">(</span><span class="n">section</span> <span class="p">!=</span> <span class="k">null</span> <span class="p">&amp;&amp;</span> <span class="p">!</span><span class="n">section</span><span class="p">.</span><span class="n">SectionInformation</span><span class="p">.</span><span class="n">IsProtected</span><span class="p">)</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">{</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">section</span><span class="p">.</span><span class="n">SectionInformation</span><span class="p">.</span><span class="n">ProtectSection</span><span class="p">(</span><span class="s">&quot;DataProtectionConfigurationProvider&quot;</span><span class="p">);</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">config</span><span class="p">.</span><span class="n">Save</span><span class="p">();</span></div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC20'><span class="p">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/977568/57b9bd28acb366ef8b3a8b93e3969505a89c3c13/gistfile1.cs" style="float:right;">view raw</a>
            <a href="https://gist.github.com/977568#file_gistfile1.cs" style="float:right;margin-right:10px;color:#666">gistfile1.cs</a>
            <a href="https://gist.github.com/977568">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/05/18/encrypt-connection-strings-on-application-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FluentMigrator Code Templates</title>
		<link>http://theoldsewingfactory.com/2011/05/17/fluentmigrator-code-templates/</link>
		<comments>http://theoldsewingfactory.com/2011/05/17/fluentmigrator-code-templates/#comments</comments>
		<pubDate>Tue, 17 May 2011 21:52:16 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[fluentmigrator]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=238</guid>
		<description><![CDATA[A little while back I created some migrator.net code templates. Since I’ve now moved over to using FluentMigrator it seemed only reasonable that I port the templates for the FluentMigrator project as well. To use them simply take the zip file from here and drop it into C:\Users\username\Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#\ Once you’ve done that [...]]]></description>
			<content:encoded><![CDATA[<p>A little while back I created some <a href="http://theoldsewingfactory.com/2010/09/30/migrator-net-code-templates/">migrator.net code templates</a>. Since I’ve now moved over to using <a href="https://github.com/schambers/fluentmigrator/">FluentMigrator</a> it seemed only reasonable that I port the templates for the FluentMigrator project as well. To use them simply take the zip file from <a href="https://github.com/ilivewithian/Fluent-Migrator-Code-Template/blob/master/Release/FluentMigratorTemplate.zip">here</a> and drop it into C:\Users\username\Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#\ Once you’ve done that restart Visual Studio and you’ll be able to do File > New File > New Fluent Migration. Give the file a name and you’ll get a code file a little like this:</p>
<p><img src="http://theoldsewingfactory.com/wp-content/uploads/2011/05/FluentMigrator.png" alt="" title="FluentMigrator" width="440" height="309" class="alignnone size-full wp-image-239" /></p>
<p>Which I happen to think is rather nice.</p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/05/17/fluentmigrator-code-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PIXELS by Patrick Jean</title>
		<link>http://theoldsewingfactory.com/2011/04/08/pixels-by-parick-jean/</link>
		<comments>http://theoldsewingfactory.com/2011/04/08/pixels-by-parick-jean/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 14:30:03 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=227</guid>
		<description><![CDATA[This has been round the web for a while now, but it still makes me smile.]]></description>
			<content:encoded><![CDATA[<p>This has been round the web for a while now, but it still makes me smile.</p>
<script type='text/javascript'>  
window.onload = document.write("<iframe width='601' height='338' marginwidth='0' marginheight='0' scrolling='auto' frameborder='0'  src='http://player.vimeo.com/video/10829255' ></iframe> "); 
 </script>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/04/08/pixels-by-parick-jean/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Quick and Dirty Cache</title>
		<link>http://theoldsewingfactory.com/2011/04/05/a-quick-and-dirty-cache/</link>
		<comments>http://theoldsewingfactory.com/2011/04/05/a-quick-and-dirty-cache/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 09:30:38 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[nasty hacks]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=219</guid>
		<description><![CDATA[Brownfield development on a tight deadline is never fun, it’s never elegant and it’s certainly not satisfying. One problem I keep finding is code that repeatedly calls the backing stores with the same query. If I don’t have the time to refactor the code to work properly I sometimes cheat and use a cache that’s [...]]]></description>
			<content:encoded><![CDATA[<p>Brownfield development on a tight deadline is never fun, it’s never elegant and it’s certainly not satisfying.</p>
<p>One problem I keep finding is code that repeatedly calls the backing stores with the same query. If I don’t have the time to refactor the code to work properly I sometimes cheat and use a cache that’s specific to the HttpContext. It’s not nice, but it does get me out of a hole every once in a while.</p>
<pre lang="csharp">public static class ContextCache
{
	public static T Get<T>(string key)
	{
		var value = HttpContext.Current.Items[key];
		return value is T ? (T)value : default(T);
	}

	public static void Put(string key, object value)
	{
		HttpContext.Current.Items[key] = value;
	}
}</pre>
<p>It’s pretty simple to use:</p>
<pre lang="csharp">var entity = ContextCache.Get<Entity>("Entity_123");
if (entity == null)
{
    entity = GetFromBackingStore(123);
    ContextCache.Put("Entity_123", entity);
}

return entity;</pre>
<p>This is definitely one of those bits of ugly code that can get you out of a hole in a rush. It aint pretty, but it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/04/05/a-quick-and-dirty-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forcing Culture Settings in WCF</title>
		<link>http://theoldsewingfactory.com/2011/04/04/forcing-culture-settings-in-wcf/</link>
		<comments>http://theoldsewingfactory.com/2011/04/04/forcing-culture-settings-in-wcf/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 19:57:59 +0000</pubDate>
		<dc:creator>Rob White</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[culture]]></category>
		<category><![CDATA[nasty hacks]]></category>
		<category><![CDATA[WCF Services]]></category>

		<guid isPermaLink="false">http://theoldsewingfactory.com/?p=222</guid>
		<description><![CDATA[I had the need to force the thread culture on a WCF service recently. The culture kept dropping back to en-US, but I needed it to run in en-GB as the client was sending me files with UK dates in them. After banging my head against every setting I could find I gave up and [...]]]></description>
			<content:encoded><![CDATA[<p>I had the need to force the thread culture on a WCF service recently. The culture kept dropping back to en-US, but I needed it to run in en-GB as the client was sending me files with UK dates in them. After banging my head against every setting I could find I gave up and opted to write a custom WCF service and force the culture. It’s not a pretty hack, but it works.</p>
<p>If you use this and it breaks your servers, steals your wallet and then runs off with your wife, consider it your fault for using code from some random blog post you found. Caveat emptor applies.</p>
<p>You can download a working sample here: <a href='http://theoldsewingfactory.com/wp-content/uploads/2011/04/WCFCulture.zip'>WCFCulture</a></p>
<p>First up we need to create a message inspector to hook in and mush about with our messages:</p>
<pre lang="csharp">public class CultureMessageInspector : IDispatchMessageInspector
{
	private readonly string _culture;
	public CultureMessageInspector(string <span class="hiddenGrammarError" pre=""><span class="hiddenGrammarError" pre="">culture)
	{
		_culture</span></span> = culture;
	}

	public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
	{
		Thread.CurrentThread.CurrentCulture = new CultureInfo(_culture);
		return null;
	}

	public void BeforeSendReply(ref Message reply, object correlationState)
	{
	}
}</pre>
<p>Then we need to hook this into an endpoint behaviour:</p>
<pre lang="csharp">public class CultureBehavior : IEndpointBehavior
{
	private readonly string _culture;
	public CultureBehavior(string culture)
	{
		_culture = culture;
	}

	public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
	{
	}

	public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
	{

	}

	public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
	{
		var inspector = new CultureMessageInspector(_culture);
		endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
	}

	public void Validate(ServiceEndpoint endpoint)
	{
	}
}</pre>
<p>And because we want to configure the culture we end up using, we need a custom extension element:</p>
<pre lang="csharp">public class CultureExtensionElement : BehaviorExtensionElement
{
	[ConfigurationProperty("Culture", DefaultValue = "en-GB")]
	public string Culture
	{
		get { return (string)base["Culture"]; }
		set { base["Culture"] = value; }
	}

	protected override object CreateBehavior()
	{
		return new CultureBehavior(Culture);
	}

	public override Type BehaviorType
	{
		get { return typeof(CultureBehavior); }
	}
}</pre>
<p>Ok, so assuming that you can get that pretty lot to compile all we need to do is hook it in via the web.config in the services project.</p>
<p>First register the extension:</p>
<pre lang="xml"><system.serviceModel>
	<extensions>
		<behaviorExtensions>
			<add name="WCFCulture" type="WCFCulture.CultureExtensionElement, WCFCulture, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
		</behaviorExtensions>
	</extensions>
</system.serviceModel></pre>
<p>Then to your behaviour simply add:</p>
<pre lang="xml"><WCFCulture Culture="en-GB" /></pre>
<p>Your resulting config should look a bit like this:</p>
<pre lang="xml"><system.serviceModel>
	<behaviors>
		<serviceBehaviors>
			<behavior name="">
				<serviceMetadata httpGetEnabled="true" />
				<serviceDebug includeExceptionDetailInFaults="false" />
			</behavior>
		</serviceBehaviors>
		<endpointBehaviors>
			<behavior name="">
				<WCFCulture Culture="en-US" />
			</behavior>
		</endpointBehaviors>
	</behaviors>
	<extensions>
		<behaviorExtensions>
			<add name="WCFCulture" type="WCFCulture.CultureExtensionElement, WCFCulture, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
		</behaviorExtensions>
	</extensions>
	<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel></pre>
<p>So now, it won&#8217;t matter what your client wants the culture to be, you can override it in config.</p>
]]></content:encoded>
			<wfw:commentRss>http://theoldsewingfactory.com/2011/04/04/forcing-culture-settings-in-wcf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

