<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>The Blomsma Code</title>
    <link>http://www.develop-one.net/blog/</link>
    <description>The mysteries of software development and networking...</description>
    <language>en-us</language>
    <copyright>Develop-One</copyright>
    <lastBuildDate>Mon, 30 Apr 2012 16:51:50 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>mark.blomsma@develop-one.com</managingEditor>
    <webMaster>mark.blomsma@develop-one.com</webMaster>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=5c220302-7104-4837-aa64-3ec4ac99dad1</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,5c220302-7104-4837-aa64-3ec4ac99dad1.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,5c220302-7104-4837-aa64-3ec4ac99dad1.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5c220302-7104-4837-aa64-3ec4ac99dad1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I had a little fun today playing with ‘==’ vs. the Equals(…) method. I knew that somewhere
in .NET 2.0 (I believe) there had been some improvements in String.Empty versus “”,
but I didn’t quite realize that this affected all string literals.
</p>
        <p>
In the code below you can see how value types and reference types may behave differently
when using ‘==’ versus the Equals method. 
<br />
My surprise came when I discovered that line 39 and 41 both return TRUE. Apparently
the string literals in an assembly get put in a master list of string constants and
then reused where the same string literal gets used. <strong>Nice!</strong><br />
The way to force the reference comparison of the string against object to actually
be different is to delay the creation of the string until runtime, like in line 52.
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="lnum"> 1: </span>
            <span class="kwrd">static</span>
            <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[]
args)</pre>
          <pre>
            <span class="lnum"> 2: </span>{</pre>
          <pre class="alt">
            <span class="lnum"> 3: </span> </pre>
          <pre>
            <span class="lnum"> 4: </span>
            <span class="rem">// value types</span>
          </pre>
          <pre class="alt">
            <span class="lnum"> 5: </span> </pre>
          <pre>
            <span class="lnum"> 6: </span>
            <span class="kwrd">int</span> x = 10;</pre>
          <pre class="alt">
            <span class="lnum"> 7: </span> </pre>
          <pre>
            <span class="lnum"> 8: </span>
            <span class="kwrd">int</span> y = 10;</pre>
          <pre class="alt">
            <span class="lnum"> 9: </span> </pre>
          <pre>
            <span class="lnum"> 10: </span> Console.WriteLine( x == y ); <span class="rem">//
compare by value -&gt; return true</span></pre>
          <pre class="alt">
            <span class="lnum"> 11: </span> </pre>
          <pre>
            <span class="lnum"> 12: </span> Console.WriteLine( x.Equals( y ) ); <span class="rem">//
compare by value -&gt; return true</span></pre>
          <pre class="alt">
            <span class="lnum"> 13: </span> </pre>
          <pre>
            <span class="lnum"> 14: </span> Console.WriteLine( <span class="kwrd">object</span>.ReferenceEquals(
x, y ) ); <span class="rem">// compare by reference -&gt; return false</span></pre>
          <pre class="alt">
            <span class="lnum"> 15: </span> </pre>
          <pre>
            <span class="lnum"> 16: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 17: </span> Console.ReadLine();</pre>
          <pre>
            <span class="lnum"> 18: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 19: </span>
            <span class="rem">// Reference types</span>
          </pre>
          <pre>
            <span class="lnum"> 20: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 21: </span> StringBuilder s1 = <span class="kwrd">new</span> StringBuilder( <span class="str">"yes"</span> );</pre>
          <pre>
            <span class="lnum"> 22: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 23: </span> StringBuilder s2 = <span class="kwrd">new</span> StringBuilder( <span class="str">"yes"</span> );</pre>
          <pre>
            <span class="lnum"> 24: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 25: </span> Console.WriteLine( s1 == s2 ); <span class="rem">//
compare by reference -&gt; return false</span></pre>
          <pre>
            <span class="lnum"> 26: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 27: </span> Console.WriteLine( s1.Equals( s2
) ); <span class="rem">// compare by value -&gt; return true</span></pre>
          <pre>
            <span class="lnum"> 28: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 29: </span> Console.WriteLine( <span class="kwrd">object</span>.ReferenceEquals(
s1, s2 ) ); <span class="rem">// compare by reference -&gt; return false</span></pre>
          <pre>
            <span class="lnum"> 30: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 31: </span> Console.ReadLine();</pre>
          <pre>
            <span class="lnum"> 32: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 33: </span>
            <span class="rem">// object and string</span>
          </pre>
          <pre>
            <span class="lnum"> 34: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 35: </span>
            <span class="kwrd">object</span> o1
= GetName();</pre>
          <pre>
            <span class="lnum"> 36: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 37: </span>
            <span class="kwrd">string</span> o2
= <span class="str">"Mark"</span>;</pre>
          <pre>
            <span class="lnum"> 38: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 39: </span> Console.WriteLine( o1 == o2 ); <span class="rem">//
compare by reference -&gt; return true</span></pre>
          <pre>
            <span class="lnum"> 40: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 41: </span> Console.WriteLine( o1.Equals( o2
) ); <span class="rem">// compare by value -&gt; return true</span></pre>
          <pre>
            <span class="lnum"> 42: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 43: </span> Console.WriteLine( <span class="kwrd">object</span>.ReferenceEquals(
o1, o2 ) ); <span class="rem">// compare by reference -&gt; return true</span></pre>
          <pre>
            <span class="lnum"> 44: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 45: </span> Console.ReadLine();</pre>
          <pre>
            <span class="lnum"> 46: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 47: </span> </pre>
          <pre>
            <span class="lnum"> 48: </span>
            <span class="rem">// object and string</span>
          </pre>
          <pre class="alt">
            <span class="lnum"> 49: </span> </pre>
          <pre>
            <span class="lnum"> 50: </span>
            <span class="kwrd">object</span> ss1 = <span class="str">"Mark"</span>;</pre>
          <pre class="alt">
            <span class="lnum"> 51: </span> </pre>
          <pre>
            <span class="lnum"> 52: </span>
            <span class="kwrd">string</span> ss2 = <span class="str">"Markx"</span>.Substring(
0, 4 );</pre>
          <pre class="alt">
            <span class="lnum"> 53: </span> </pre>
          <pre>
            <span class="lnum"> 54: </span> Console.WriteLine( ss1 == ss2 ); <span class="rem">//
compare by reference -&gt; return false</span></pre>
          <pre class="alt">
            <span class="lnum"> 55: </span> </pre>
          <pre>
            <span class="lnum"> 56: </span> Console.WriteLine( ss1.Equals( ss2 ) ); <span class="rem">//
compare by value -&gt; return true</span></pre>
          <pre class="alt">
            <span class="lnum"> 57: </span> </pre>
          <pre>
            <span class="lnum"> 58: </span> Console.WriteLine( <span class="kwrd">object</span>.ReferenceEquals(
ss1, ss2 ) ); <span class="rem">// compare by reference -&gt; return false</span></pre>
          <pre class="alt">
            <span class="lnum"> 59: </span> </pre>
          <pre>
            <span class="lnum"> 60: </span> Console.ReadLine();</pre>
          <pre class="alt">
            <span class="lnum"> 61: </span>}</pre>
          <pre>
            <span class="lnum"> 62: </span> </pre>
          <pre class="alt">
            <span class="lnum"> 63: </span>
            <span class="kwrd">static</span>
            <span class="kwrd">object</span> GetName()</pre>
          <pre>
            <span class="lnum"> 64: </span>{</pre>
          <pre class="alt">
            <span class="lnum"> 65: </span>
            <span class="kwrd">return</span>
            <span class="str">"Mark"</span>;</pre>
          <pre>
            <span class="lnum"> 66: </span>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
      </body>
      <title>String literals and ‘==’ versus Equals(…)</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,5c220302-7104-4837-aa64-3ec4ac99dad1.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/04/30/StringLiteralsAndVersusEquals.aspx</link>
      <pubDate>Mon, 30 Apr 2012 16:51:50 GMT</pubDate>
      <description>&lt;p&gt;
I had a little fun today playing with ‘==’ vs. the Equals(…) method. I knew that somewhere
in .NET 2.0 (I believe) there had been some improvements in String.Empty versus “”,
but I didn’t quite realize that this affected all string literals.
&lt;/p&gt;
&lt;p&gt;
In the code below you can see how value types and reference types may behave differently
when using ‘==’ versus the Equals method. 
&lt;br /&gt;
My surprise came when I discovered that line 39 and 41 both return TRUE. Apparently
the string literals in an assembly get put in a master list of string constants and
then reused where the same string literal gets used. &lt;strong&gt;Nice!&lt;/strong&gt; 
&lt;br /&gt;
The way to force the reference comparison of the string against object to actually
be different is to delay the creation of the string until runtime, like in line 52.
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[]
args)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; &lt;span class="rem"&gt;// value types&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; x = 10;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; y = 10;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; Console.WriteLine( x == y ); &lt;span class="rem"&gt;//
compare by value -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 11: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 12: &lt;/span&gt; Console.WriteLine( x.Equals( y ) ); &lt;span class="rem"&gt;//
compare by value -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 13: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 14: &lt;/span&gt; Console.WriteLine( &lt;span class="kwrd"&gt;object&lt;/span&gt;.ReferenceEquals(
x, y ) ); &lt;span class="rem"&gt;// compare by reference -&amp;gt; return false&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 15: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 16: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 17: &lt;/span&gt; Console.ReadLine();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 18: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 19: &lt;/span&gt; &lt;span class="rem"&gt;// Reference types&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 20: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 21: &lt;/span&gt; StringBuilder s1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder( &lt;span class="str"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt; );&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 22: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 23: &lt;/span&gt; StringBuilder s2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder( &lt;span class="str"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt; );&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 24: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 25: &lt;/span&gt; Console.WriteLine( s1 == s2 ); &lt;span class="rem"&gt;//
compare by reference -&amp;gt; return false&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 26: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 27: &lt;/span&gt; Console.WriteLine( s1.Equals( s2
) ); &lt;span class="rem"&gt;// compare by value -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 28: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 29: &lt;/span&gt; Console.WriteLine( &lt;span class="kwrd"&gt;object&lt;/span&gt;.ReferenceEquals(
s1, s2 ) ); &lt;span class="rem"&gt;// compare by reference -&amp;gt; return false&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 30: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 31: &lt;/span&gt; Console.ReadLine();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 32: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 33: &lt;/span&gt; &lt;span class="rem"&gt;// object and string&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 34: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 35: &lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; o1
= GetName();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 36: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 37: &lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; o2
= &lt;span class="str"&gt;&amp;quot;Mark&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 38: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 39: &lt;/span&gt; Console.WriteLine( o1 == o2 ); &lt;span class="rem"&gt;//
compare by reference -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 40: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 41: &lt;/span&gt; Console.WriteLine( o1.Equals( o2
) ); &lt;span class="rem"&gt;// compare by value -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 42: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 43: &lt;/span&gt; Console.WriteLine( &lt;span class="kwrd"&gt;object&lt;/span&gt;.ReferenceEquals(
o1, o2 ) ); &lt;span class="rem"&gt;// compare by reference -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 44: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 45: &lt;/span&gt; Console.ReadLine();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 46: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 47: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 48: &lt;/span&gt; &lt;span class="rem"&gt;// object and string&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 49: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 50: &lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; ss1 = &lt;span class="str"&gt;&amp;quot;Mark&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 51: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 52: &lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ss2 = &lt;span class="str"&gt;&amp;quot;Markx&amp;quot;&lt;/span&gt;.Substring(
0, 4 );&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 53: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 54: &lt;/span&gt; Console.WriteLine( ss1 == ss2 ); &lt;span class="rem"&gt;//
compare by reference -&amp;gt; return false&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 55: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 56: &lt;/span&gt; Console.WriteLine( ss1.Equals( ss2 ) ); &lt;span class="rem"&gt;//
compare by value -&amp;gt; return true&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 57: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 58: &lt;/span&gt; Console.WriteLine( &lt;span class="kwrd"&gt;object&lt;/span&gt;.ReferenceEquals(
ss1, ss2 ) ); &lt;span class="rem"&gt;// compare by reference -&amp;gt; return false&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 59: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 60: &lt;/span&gt; Console.ReadLine();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 61: &lt;/span&gt;}&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 62: &lt;/span&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 63: &lt;/span&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; GetName()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 64: &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 65: &lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;&amp;quot;Mark&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 66: &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,5c220302-7104-4837-aa64-3ec4ac99dad1.aspx</comments>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=1d709d3e-8798-4846-83d5-fa3155929b73</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,1d709d3e-8798-4846-83d5-fa3155929b73.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,1d709d3e-8798-4846-83d5-fa3155929b73.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1d709d3e-8798-4846-83d5-fa3155929b73</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
ISO images with the Windows 8 Consumer Preview are now available for download. Go
to <a title="http://windows.microsoft.com/en-US/windows-8/iso" href="http://windows.microsoft.com/en-US/windows-8/iso">http://windows.microsoft.com/en-US/windows-8/iso</a> to
get the bits.
</p>
      </body>
      <title>Windows 8 Consumer Preview</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,1d709d3e-8798-4846-83d5-fa3155929b73.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/02/29/Windows8ConsumerPreview.aspx</link>
      <pubDate>Wed, 29 Feb 2012 15:57:01 GMT</pubDate>
      <description>&lt;p&gt;
ISO images with the Windows 8 Consumer Preview are now available for download. Go
to &lt;a title="http://windows.microsoft.com/en-US/windows-8/iso" href="http://windows.microsoft.com/en-US/windows-8/iso"&gt;http://windows.microsoft.com/en-US/windows-8/iso&lt;/a&gt; to
get the bits.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,1d709d3e-8798-4846-83d5-fa3155929b73.aspx</comments>
      <category>Windows 8</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=add6b001-4460-46d4-98aa-f467f6f72d4c</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,add6b001-4460-46d4-98aa-f467f6f72d4c.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,add6b001-4460-46d4-98aa-f467f6f72d4c.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=add6b001-4460-46d4-98aa-f467f6f72d4c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft Visual Studio 11 Ultimate Beta has just become available for download. Go
to <a title="http://www.microsoft.com/download/en/details.aspx?id=28975" href="http://www.microsoft.com/download/en/details.aspx?id=28975">http://www.microsoft.com/download/en/details.aspx?id=28975</a> to
download the bits.
</p>
      </body>
      <title>Microsoft Visual Studio 11 Ultimate Beta</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,add6b001-4460-46d4-98aa-f467f6f72d4c.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/02/29/MicrosoftVisualStudio11UltimateBeta.aspx</link>
      <pubDate>Wed, 29 Feb 2012 15:55:06 GMT</pubDate>
      <description>&lt;p&gt;
Microsoft Visual Studio 11 Ultimate Beta has just become available for download. Go
to &lt;a title="http://www.microsoft.com/download/en/details.aspx?id=28975" href="http://www.microsoft.com/download/en/details.aspx?id=28975"&gt;http://www.microsoft.com/download/en/details.aspx?id=28975&lt;/a&gt; to
download the bits.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,add6b001-4460-46d4-98aa-f467f6f72d4c.aspx</comments>
      <category>.NET</category>
      <category>C#</category>
      <category>Visual Studio 2012</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=1482ce44-0038-41ba-895c-e769243e04b6</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,1482ce44-0038-41ba-895c-e769243e04b6.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,1482ce44-0038-41ba-895c-e769243e04b6.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1482ce44-0038-41ba-895c-e769243e04b6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you’re interested in the Include method in a LINQ to Entities queries to be type-safe,
then Joe Ferner has the answer for you in this post: Type-Safe Entity Framework Include: <a title="http://www.nearinfinity.com/blogs/joe_ferner/type-safe_entity_framework_inc.html" href="http://www.nearinfinity.com/blogs/joe_ferner/type-safe_entity_framework_inc.html">http://www.nearinfinity.com/blogs/joe_ferner/type-safe_entity_framework_inc.html</a></p>
      </body>
      <title>Type-Safe Include extension method for Entity Framework</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,1482ce44-0038-41ba-895c-e769243e04b6.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/01/24/TypeSafeIncludeExtensionMethodForEntityFramework.aspx</link>
      <pubDate>Tue, 24 Jan 2012 20:47:02 GMT</pubDate>
      <description>&lt;p&gt;
If you’re interested in the Include method in a LINQ to Entities queries to be type-safe,
then Joe Ferner has the answer for you in this post: Type-Safe Entity Framework Include: &lt;a title="http://www.nearinfinity.com/blogs/joe_ferner/type-safe_entity_framework_inc.html" href="http://www.nearinfinity.com/blogs/joe_ferner/type-safe_entity_framework_inc.html"&gt;http://www.nearinfinity.com/blogs/joe_ferner/type-safe_entity_framework_inc.html&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,1482ce44-0038-41ba-895c-e769243e04b6.aspx</comments>
      <category>Entity Framework</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=a48a2178-40fc-4441-8773-0f340ba33057</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,a48a2178-40fc-4441-8773-0f340ba33057.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,a48a2178-40fc-4441-8773-0f340ba33057.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a48a2178-40fc-4441-8773-0f340ba33057</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you’re using Entity Framework Code First, then you may want to create an index
on some of your table. The way to do this is to call “Database.ExecuteSqlCommand”
in the “Seed” method of your database initializer. The sample below shows how it is
done (thanks to Rolf for pointing me in the right direction): 
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="kwrd">using</span> System;</pre>
          <pre>
            <span class="kwrd">using</span> System.Collections.Generic;</pre>
          <pre class="alt">
            <span class="kwrd">using</span> System.Linq;</pre>
          <pre>
            <span class="kwrd">using</span> System.Text;</pre>
          <pre class="alt">
            <span class="kwrd">using</span> System.Data.Entity;</pre>
          <pre>
            <span class="kwrd">using</span> System.ComponentModel.DataAnnotations;</pre>
          <pre class="alt"> </pre>
          <pre>
            <span class="kwrd">namespace</span> CodeFirstPlayground</pre>
          <pre class="alt">{</pre>
          <pre>
            <span class="kwrd">class</span> Program</pre>
          <pre class="alt">  {</pre>
          <pre>
            <span class="kwrd">static</span>
            <span class="kwrd">void</span> Main( <span class="kwrd">string</span>[]
args )</pre>
          <pre class="alt">    {</pre>
          <pre>      Database.SetInitializer&lt;CodeFirstSampleModel&gt;( <span class="kwrd">new</span> CodeFirstSampleDbInitializer()
);</pre>
          <pre class="alt"> </pre>
          <pre>
            <span class="kwrd">using</span> ( var model = <span class="kwrd">new</span> CodeFirstSampleModel()
)</pre>
          <pre class="alt">      {</pre>
          <pre>        var query = from c <span class="kwrd">in</span> model.Customers</pre>
          <pre class="alt">
            <span class="kwrd">where</span> c.Name != <span class="kwrd">null</span></pre>
          <pre>                    select c;</pre>
          <pre class="alt"> </pre>
          <pre>
            <span class="kwrd">foreach</span> ( var item <span class="kwrd">in</span> query
)</pre>
          <pre class="alt">        {</pre>
          <pre>          Console.WriteLine( item.Name );</pre>
          <pre class="alt">        }</pre>
          <pre>      }</pre>
          <pre class="alt"> </pre>
          <pre>      Console.ReadLine();</pre>
          <pre class="alt"> </pre>
          <pre>    }</pre>
          <pre class="alt">  }</pre>
          <pre> </pre>
          <pre class="alt">
            <span class="kwrd">public</span>
            <span class="kwrd">class</span> CodeFirstSampleModel
: DbContext</pre>
          <pre>  {</pre>
          <pre class="alt">
            <span class="kwrd">public</span> CodeFirstSampleModel()</pre>
          <pre>      : <span class="kwrd">base</span>( <span class="str">"CodeFirstSampleDB"</span> )</pre>
          <pre class="alt">    {</pre>
          <pre>      Customers = <span class="kwrd">this</span>.Set&lt;Customer&gt;();</pre>
          <pre class="alt">    }</pre>
          <pre> </pre>
          <pre class="alt">
            <span class="kwrd">public</span> DbSet&lt;Customer&gt; Customers
{ get; set; }</pre>
          <pre> </pre>
          <pre class="alt">  }</pre>
          <pre> </pre>
          <pre class="alt">
            <span class="kwrd">public</span>
            <span class="kwrd">class</span> CodeFirstSampleDbInitializer
: DropCreateDatabaseAlways&lt;CodeFirstSampleModel&gt;</pre>
          <pre>  {</pre>
          <pre class="alt">
            <span class="kwrd">protected</span>
            <span class="kwrd">override</span>
            <span class="kwrd">void</span> Seed(
CodeFirstSampleModel context )</pre>
          <pre>    {</pre>
          <pre class="alt">      context.Database.ExecuteSqlCommand( <span class="str">"CREATE
INDEX IX_Customer_Name ON Customers (Name) "</span> );</pre>
          <pre>
          </pre>
          <pre class="alt">      Customer c = <span class="kwrd">new</span> Customer()</pre>
          <pre>      {</pre>
          <pre class="alt">        Name = <span class="str">"Mark"</span>,</pre>
          <pre>        LastOrder = DateTime.Now</pre>
          <pre class="alt">      };</pre>
          <pre> </pre>
          <pre class="alt">      context.Customers.Add( c );</pre>
          <pre> </pre>
          <pre class="alt">
            <span class="kwrd">base</span>.Seed( context );</pre>
          <pre>    }</pre>
          <pre class="alt">  }</pre>
          <pre> </pre>
          <pre class="alt"> </pre>
          <pre>
            <span class="kwrd">public</span>
            <span class="kwrd">class</span> Customer</pre>
          <pre class="alt">  {</pre>
          <pre>    [Key]</pre>
          <pre class="alt">
            <span class="kwrd">public</span>
            <span class="kwrd">int</span> Id
{ get; set; }</pre>
          <pre>    [Required]</pre>
          <pre class="alt">    [MaxLength( 50, ErrorMessage = <span class="str">"Customer
name must be 50 characters or less."</span> )]</pre>
          <pre>
            <span class="kwrd">public</span>
            <span class="kwrd">string</span> Name {
get; set; }</pre>
          <pre class="alt">
          </pre>
          <pre>
            <span class="kwrd">public</span> DateTime? LastOrder { get; set; }</pre>
          <pre class="alt">  }</pre>
          <pre>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
      </body>
      <title>Generating an index in the database using Entity Framework Code First</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,a48a2178-40fc-4441-8773-0f340ba33057.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/01/17/GeneratingAnIndexInTheDatabaseUsingEntityFrameworkCodeFirst.aspx</link>
      <pubDate>Tue, 17 Jan 2012 17:24:40 GMT</pubDate>
      <description>&lt;p&gt;
If you’re using Entity Framework Code First, then you may want to create an index
on some of your table. The way to do this is to call “Database.ExecuteSqlCommand”
in the “Seed” method of your database initializer. The sample below shows how it is
done (thanks to Rolf for pointing me in the right direction): 
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Data.Entity;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ComponentModel.DataAnnotations;&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; CodeFirstPlayground&lt;/pre&gt;
&lt;pre class="alt"&gt;{&lt;/pre&gt;
&lt;pre&gt;  &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;
&lt;pre class="alt"&gt;  {&lt;/pre&gt;
&lt;pre&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main( &lt;span class="kwrd"&gt;string&lt;/span&gt;[]
args )&lt;/pre&gt;
&lt;pre class="alt"&gt;    {&lt;/pre&gt;
&lt;pre&gt;      Database.SetInitializer&amp;lt;CodeFirstSampleModel&amp;gt;( &lt;span class="kwrd"&gt;new&lt;/span&gt; CodeFirstSampleDbInitializer()
);&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;      &lt;span class="kwrd"&gt;using&lt;/span&gt; ( var model = &lt;span class="kwrd"&gt;new&lt;/span&gt; CodeFirstSampleModel()
)&lt;/pre&gt;
&lt;pre class="alt"&gt;      {&lt;/pre&gt;
&lt;pre&gt;        var query = from c &lt;span class="kwrd"&gt;in&lt;/span&gt; model.Customers&lt;/pre&gt;
&lt;pre class="alt"&gt;                    &lt;span class="kwrd"&gt;where&lt;/span&gt; c.Name != &lt;span class="kwrd"&gt;null&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;                    select c;&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; ( var item &lt;span class="kwrd"&gt;in&lt;/span&gt; query
)&lt;/pre&gt;
&lt;pre class="alt"&gt;        {&lt;/pre&gt;
&lt;pre&gt;          Console.WriteLine( item.Name );&lt;/pre&gt;
&lt;pre class="alt"&gt;        }&lt;/pre&gt;
&lt;pre&gt;      }&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;      Console.ReadLine();&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;  }&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CodeFirstSampleModel
: DbContext&lt;/pre&gt;
&lt;pre&gt;  {&lt;/pre&gt;
&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; CodeFirstSampleModel()&lt;/pre&gt;
&lt;pre&gt;      : &lt;span class="kwrd"&gt;base&lt;/span&gt;( &lt;span class="str"&gt;&amp;quot;CodeFirstSampleDB&amp;quot;&lt;/span&gt; )&lt;/pre&gt;
&lt;pre class="alt"&gt;    {&lt;/pre&gt;
&lt;pre&gt;      Customers = &lt;span class="kwrd"&gt;this&lt;/span&gt;.Set&amp;lt;Customer&amp;gt;();&lt;/pre&gt;
&lt;pre class="alt"&gt;    }&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; DbSet&amp;lt;Customer&amp;gt; Customers
{ get; set; }&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;  }&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CodeFirstSampleDbInitializer
: DropCreateDatabaseAlways&amp;lt;CodeFirstSampleModel&amp;gt;&lt;/pre&gt;
&lt;pre&gt;  {&lt;/pre&gt;
&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Seed(
CodeFirstSampleModel context )&lt;/pre&gt;
&lt;pre&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;      context.Database.ExecuteSqlCommand( &lt;span class="str"&gt;&amp;quot;CREATE
INDEX IX_Customer_Name ON Customers (Name) &amp;quot;&lt;/span&gt; );&lt;/pre&gt;
&lt;pre&gt;      &lt;/pre&gt;
&lt;pre class="alt"&gt;      Customer c = &lt;span class="kwrd"&gt;new&lt;/span&gt; Customer()&lt;/pre&gt;
&lt;pre&gt;      {&lt;/pre&gt;
&lt;pre class="alt"&gt;        Name = &lt;span class="str"&gt;&amp;quot;Mark&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;        LastOrder = DateTime.Now&lt;/pre&gt;
&lt;pre class="alt"&gt;      };&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;      context.Customers.Add( c );&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;      &lt;span class="kwrd"&gt;base&lt;/span&gt;.Seed( context );&lt;/pre&gt;
&lt;pre&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;  }&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Customer&lt;/pre&gt;
&lt;pre class="alt"&gt;  {&lt;/pre&gt;
&lt;pre&gt;    [Key]&lt;/pre&gt;
&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id
{ get; set; }&lt;/pre&gt;
&lt;pre&gt;    [Required]&lt;/pre&gt;
&lt;pre class="alt"&gt;    [MaxLength( 50, ErrorMessage = &lt;span class="str"&gt;&amp;quot;Customer
name must be 50 characters or less.&amp;quot;&lt;/span&gt; )]&lt;/pre&gt;
&lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name {
get; set; }&lt;/pre&gt;
&lt;pre class="alt"&gt;    &lt;/pre&gt;
&lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; DateTime? LastOrder { get; set; }&lt;/pre&gt;
&lt;pre class="alt"&gt;  }&lt;/pre&gt;
&lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,a48a2178-40fc-4441-8773-0f340ba33057.aspx</comments>
      <category>Entity Framework</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=98a92e31-80ee-4a8f-9562-8dddc846a06a</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,98a92e31-80ee-4a8f-9562-8dddc846a06a.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,98a92e31-80ee-4a8f-9562-8dddc846a06a.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=98a92e31-80ee-4a8f-9562-8dddc846a06a</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just a quick service announcement: 
</p>
        <p>
Winxnet, in Portland, has started hosting the first Maine based SharePoint User Group. 
</p>
        <p>
For more information visit: <a href="http://www.winxnet.com/spugme">www.winxnet.com/spugme</a></p>
      </body>
      <title>SharePoint UG Maine</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,98a92e31-80ee-4a8f-9562-8dddc846a06a.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/01/04/SharePointUGMaine.aspx</link>
      <pubDate>Wed, 04 Jan 2012 10:55:41 GMT</pubDate>
      <description>&lt;p&gt;
Just a quick service announcement: 
&lt;/p&gt;
&lt;p&gt;
Winxnet, in Portland, has started hosting the first Maine based SharePoint User Group. 
&lt;/p&gt;
&lt;p&gt;
For more information visit: &lt;a href="http://www.winxnet.com/spugme"&gt;www.winxnet.com/spugme&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,98a92e31-80ee-4a8f-9562-8dddc846a06a.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=750d7a4d-b0c2-4218-ab1d-8fedbc69d952</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,750d7a4d-b0c2-4218-ab1d-8fedbc69d952.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,750d7a4d-b0c2-4218-ab1d-8fedbc69d952.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=750d7a4d-b0c2-4218-ab1d-8fedbc69d952</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Microsoft-Most-Valuable-Professional-201_5C0D/mvp-logo_2.png">
            <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="mvp-logo" border="0" alt="mvp-logo" align="right" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Microsoft-Most-Valuable-Professional-201_5C0D/mvp-logo_thumb.png" width="157" height="244" />
          </a>I’m
honored to have been awarded the Microsoft Most Valuable Professional 2012 Award for
contributions in the Visual C# technical communities. I’m honored to be counted amongst
the 228 people world wide to receive this award. 
</p>
        <p>
“At Microsoft, we believe that technical communities enhance people’s lives and the
industry’s success because independent experts, like you, help others extract greater
value from products and technologies through the free and objective exchange of knowledge.
As a Microsoft MVP, you are part of a highly select group of experts that represent
technology’s best and brightest who share a deep commitment to community and a willingness
to help others.” 
<br />
    - Heather Kostes
</p>
        <p>
Thank you Microsoft and thank you Heather! I’m looking forward to organizing more
events again this year for the <a href="http://www.maine-devnet.org" target="_blank">Maine
Developer Network</a> and hanging out with the <a href="http://www.bangordevelopers.com" target="_blank">Bangor
Area .NET Developers</a> and I’m looking forward to Maine Code Camp #3 and also to
meeting my fellow MVPs and product groups in Seattle at the MVP Summit 2012. 
</p>
        <p>
- Mark
</p>
      </body>
      <title>Microsoft Most Valuable Professional 2012</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,750d7a4d-b0c2-4218-ab1d-8fedbc69d952.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/01/02/MicrosoftMostValuableProfessional2012.aspx</link>
      <pubDate>Mon, 02 Jan 2012 11:47:23 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Microsoft-Most-Valuable-Professional-201_5C0D/mvp-logo_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="mvp-logo" border="0" alt="mvp-logo" align="right" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Microsoft-Most-Valuable-Professional-201_5C0D/mvp-logo_thumb.png" width="157" height="244" /&gt;&lt;/a&gt;I’m
honored to have been awarded the Microsoft Most Valuable Professional 2012 Award for
contributions in the Visual C# technical communities. I’m honored to be counted amongst
the 228 people world wide to receive this award. 
&lt;/p&gt;
&lt;p&gt;
“At Microsoft, we believe that technical communities enhance people’s lives and the
industry’s success because independent experts, like you, help others extract greater
value from products and technologies through the free and objective exchange of knowledge.
As a Microsoft MVP, you are part of a highly select group of experts that represent
technology’s best and brightest who share a deep commitment to community and a willingness
to help others.” 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; - Heather Kostes
&lt;/p&gt;
&lt;p&gt;
Thank you Microsoft and thank you Heather! I’m looking forward to organizing more
events again this year for the &lt;a href="http://www.maine-devnet.org" target="_blank"&gt;Maine
Developer Network&lt;/a&gt; and hanging out with the &lt;a href="http://www.bangordevelopers.com" target="_blank"&gt;Bangor
Area .NET Developers&lt;/a&gt; and I’m looking forward to Maine Code Camp #3 and also to
meeting my fellow MVPs and product groups in Seattle at the MVP Summit 2012. 
&lt;/p&gt;
&lt;p&gt;
- Mark
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,750d7a4d-b0c2-4218-ab1d-8fedbc69d952.aspx</comments>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=6f3d5fcf-e148-4134-86e4-55349ec28f6f</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,6f3d5fcf-e148-4134-86e4-55349ec28f6f.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,6f3d5fcf-e148-4134-86e4-55349ec28f6f.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6f3d5fcf-e148-4134-86e4-55349ec28f6f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Sometimes you’re working on a website and you get some images with text in them, but
no one remembers what fonts was used in the image. No fear! There is a website call
“What The Font” that will take your picture and tell you what font was used: <a title="http://new.myfonts.com/WhatTheFont/" href="http://new.myfonts.com/WhatTheFont/">http://new.myfonts.com/WhatTheFont/</a></p>
      </body>
      <title>How to discover what font was used</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,6f3d5fcf-e148-4134-86e4-55349ec28f6f.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/12/26/HowToDiscoverWhatFontWasUsed.aspx</link>
      <pubDate>Mon, 26 Dec 2011 12:34:25 GMT</pubDate>
      <description>&lt;p&gt;
Sometimes you’re working on a website and you get some images with text in them, but
no one remembers what fonts was used in the image. No fear! There is a website call
“What The Font” that will take your picture and tell you what font was used: &lt;a title="http://new.myfonts.com/WhatTheFont/" href="http://new.myfonts.com/WhatTheFont/"&gt;http://new.myfonts.com/WhatTheFont/&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,6f3d5fcf-e148-4134-86e4-55349ec28f6f.aspx</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=ca4436f8-9849-4f02-ac91-331ae1f87845</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,ca4436f8-9849-4f02-ac91-331ae1f87845.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,ca4436f8-9849-4f02-ac91-331ae1f87845.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ca4436f8-9849-4f02-ac91-331ae1f87845</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Silverlight 5 got released this weekend and can be downloaded here: <a title="http://www.silverlight.net/downloads" href="http://www.silverlight.net/downloads">http://www.silverlight.net/downloads</a>.
</p>
        <h4>Summary of the features
</h4>
        <p>
(from the Silverlight 5 download package)
</p>
        <h5>
          <b>Improved media support <a name="business"></a></b>
        </h5>
        <ul>
          <li>
Low Latency Audio Playback 
</li>
          <li>
Variable Speed Playback 
</li>
          <li>
H/W Decode of H.264 media 
</li>
          <li>
DRM Key Rotation/LiveTV Playback 
</li>
          <li>
Application-Restricted Media</li>
        </ul>
        <h5>Improved Text support
</h5>
        <ul>
          <li>
Text Tracking &amp; Leading 
</li>
          <li>
Linked Text Containers 
</li>
          <li>
OpenType and Pixel Snapped Text 
</li>
          <li>
Postscript vector printing 
</li>
          <li>
Performance improvements for Block Layout Engine<strong>. 
<br /></strong></li>
        </ul>
        <h5>
          <b>Building next-generation business applications</b>
        </h5>
        <ul>
          <li>
PivotViewer 
</li>
          <li>
ClickCount 
</li>
          <li>
Listbox/ComboBox type-ahead text searching 
</li>
          <li>
Ancestor RelativeSource Binding 
</li>
          <li>
Implicit DataTemplates 
</li>
          <li>
DataContextChanged event 
</li>
          <li>
Added PropertyChanged to the UpdateSourceTrigger enum 
</li>
          <li>
Save File and Open File Dialog 
</li>
          <li>
Databinding Debugging 
</li>
          <li>
Custom Markup Extensions 
</li>
          <li>
Binding on Style Setters</li>
        </ul>
        <h5>Silverlight 5 performance improvements
</h5>
        <ul>
          <li>
            <a name="graphics">
            </a>Parser Performance Improvements 
</li>
          <li>
Network Latency Improvements 
</li>
          <li>
H/W accelerated rendering in IE9 windowless mode 
</li>
          <li>
Multicore JIT 
</li>
          <li>
            <i>64-</i>bit browser support</li>
        </ul>
        <h5>Graphics improvements
</h5>
        <ul>
          <li>
Improved Graphics stack 
</li>
          <li>
3D</li>
        </ul>
        <h5>"Trusted Application" model
</h5>
        <ul>
          <li>
Multiple window support 
</li>
          <li>
Full-Trust in-browser 
</li>
          <li>
In-browser HTML support 
</li>
          <li>
Unrestricted File System Access 
</li>
          <li>
P/Invoke support</li>
        </ul>
        <h5>Tools improvements
</h5>
        <ul>
          <li>
Visual Studio Team Test support</li>
        </ul>
      </body>
      <title>Silverlight 5 release</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,ca4436f8-9849-4f02-ac91-331ae1f87845.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/12/12/Silverlight5Release.aspx</link>
      <pubDate>Mon, 12 Dec 2011 14:36:09 GMT</pubDate>
      <description>&lt;p&gt;
Silverlight 5 got released this weekend and can be downloaded here: &lt;a title="http://www.silverlight.net/downloads" href="http://www.silverlight.net/downloads"&gt;http://www.silverlight.net/downloads&lt;/a&gt;.
&lt;/p&gt;
&lt;h4&gt;Summary of the features
&lt;/h4&gt;
&lt;p&gt;
(from the Silverlight 5 download package)
&lt;/p&gt;
&lt;h5&gt;&lt;b&gt;Improved media support &lt;a name="business"&gt;&lt;/a&gt;&lt;/b&gt;
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Low Latency Audio Playback 
&lt;/li&gt;
&lt;li&gt;
Variable Speed Playback 
&lt;/li&gt;
&lt;li&gt;
H/W Decode of H.264 media 
&lt;/li&gt;
&lt;li&gt;
DRM Key Rotation/LiveTV Playback 
&lt;/li&gt;
&lt;li&gt;
Application-Restricted Media&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Improved Text support
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Text Tracking &amp;amp; Leading 
&lt;/li&gt;
&lt;li&gt;
Linked Text Containers 
&lt;/li&gt;
&lt;li&gt;
OpenType and Pixel Snapped Text 
&lt;/li&gt;
&lt;li&gt;
Postscript vector printing 
&lt;/li&gt;
&lt;li&gt;
Performance improvements for Block Layout Engine&lt;strong&gt;. 
&lt;br /&gt;
&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;&lt;b&gt;Building next-generation business applications&lt;/b&gt;
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
PivotViewer 
&lt;/li&gt;
&lt;li&gt;
ClickCount 
&lt;/li&gt;
&lt;li&gt;
Listbox/ComboBox type-ahead text searching 
&lt;/li&gt;
&lt;li&gt;
Ancestor RelativeSource Binding 
&lt;/li&gt;
&lt;li&gt;
Implicit DataTemplates 
&lt;/li&gt;
&lt;li&gt;
DataContextChanged event 
&lt;/li&gt;
&lt;li&gt;
Added PropertyChanged to the UpdateSourceTrigger enum 
&lt;/li&gt;
&lt;li&gt;
Save File and Open File Dialog 
&lt;/li&gt;
&lt;li&gt;
Databinding Debugging 
&lt;/li&gt;
&lt;li&gt;
Custom Markup Extensions 
&lt;/li&gt;
&lt;li&gt;
Binding on Style Setters&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Silverlight 5 performance improvements
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a name="graphics"&gt;&lt;/a&gt;Parser Performance Improvements 
&lt;/li&gt;
&lt;li&gt;
Network Latency Improvements 
&lt;/li&gt;
&lt;li&gt;
H/W accelerated rendering in IE9 windowless mode 
&lt;/li&gt;
&lt;li&gt;
Multicore JIT 
&lt;/li&gt;
&lt;li&gt;
&lt;i&gt;64-&lt;/i&gt;bit browser support&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Graphics improvements
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Improved Graphics stack 
&lt;/li&gt;
&lt;li&gt;
3D&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;&amp;quot;Trusted Application&amp;quot; model
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Multiple window support 
&lt;/li&gt;
&lt;li&gt;
Full-Trust in-browser 
&lt;/li&gt;
&lt;li&gt;
In-browser HTML support 
&lt;/li&gt;
&lt;li&gt;
Unrestricted File System Access 
&lt;/li&gt;
&lt;li&gt;
P/Invoke support&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Tools improvements
&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;
Visual Studio Team Test support&lt;/li&gt;
&lt;/ul&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,ca4436f8-9849-4f02-ac91-331ae1f87845.aspx</comments>
      <category>.NET</category>
      <category>Silverlight</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=eccb1ad4-4659-472e-baa7-b9f4143e3652</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,eccb1ad4-4659-472e-baa7-b9f4143e3652.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,eccb1ad4-4659-472e-baa7-b9f4143e3652.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=eccb1ad4-4659-472e-baa7-b9f4143e3652</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The next Maine Developer Network meeting will be in Augusta on Wednesday November
16th, starting at 9:00am finishing at 12:00 pm. 
<br />
It is going to be a unique event about Windows Azure: "Playing Games in the Cloud"
and will be hosted by Jim O'Neil, Microsoft Developer Evangelist. It will be more
of a workshop than just presentation, so bring your laptop and make sure it is prepped
to for the class. 
<br />
For more info see: <a href="http://www.maine-devnet.org">www.maine-devnet.org</a></p>
      </body>
      <title>Augusta Developer Event, November 16th 2011</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,eccb1ad4-4659-472e-baa7-b9f4143e3652.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/11/14/AugustaDeveloperEventNovember16th2011.aspx</link>
      <pubDate>Mon, 14 Nov 2011 13:08:33 GMT</pubDate>
      <description>&lt;p&gt;
The next Maine Developer Network meeting will be in Augusta on Wednesday November
16th, starting at 9:00am finishing at 12:00 pm. 
&lt;br /&gt;
It is going to be a unique event about Windows Azure: &amp;quot;Playing Games in the Cloud&amp;quot;
and will be hosted by Jim O'Neil, Microsoft Developer Evangelist. It will be more
of a workshop than just presentation, so bring your laptop and make sure it is prepped
to for the class. 
&lt;br /&gt;
For more info see: &lt;a href="http://www.maine-devnet.org"&gt;www.maine-devnet.org&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,eccb1ad4-4659-472e-baa7-b9f4143e3652.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=ae42c4b4-4d6e-464e-98e0-c430ea35b4ab</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,ae42c4b4-4d6e-464e-98e0-c430ea35b4ab.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,ae42c4b4-4d6e-464e-98e0-c430ea35b4ab.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ae42c4b4-4d6e-464e-98e0-c430ea35b4ab</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Richard Blewett reminded me that the XmlReader.ReadSubtree method makes it even easier
to use LINQ to XML with a streaming approach. The code sample below will load nodes
from an arbitrary XML files and yield them to the caller as they’re read from file:
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="kwrd">static</span> IEnumerable&lt;XElement&gt; Load(<span class="kwrd">string</span> filename, <span class="kwrd">string</span> elementName)</pre>
          <pre>{</pre>
          <pre class="alt">    XmlReaderSettings settings = <span class="kwrd">new</span> XmlReaderSettings();</pre>
          <pre>    settings.IgnoreWhitespace = <span class="kwrd">true</span>;</pre>
          <pre class="alt">
            <span class="kwrd">using</span> (XmlReader reader = XmlReader.Create(filename,
settings))</pre>
          <pre>    {</pre>
          <pre class="alt">
            <span class="kwrd">while</span> (reader.ReadToFollowing(elementName))</pre>
          <pre>        {</pre>
          <pre class="alt">
            <span class="rem">// build element from subtree</span>
          </pre>
          <pre>            XElement element = XElement.Load(reader.ReadSubtree());</pre>
          <pre class="alt">
            <span class="kwrd">yield</span>
            <span class="kwrd">return</span> element;</pre>
          <pre>        }</pre>
          <pre class="alt">    }</pre>
          <pre>}</pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
      </body>
      <title>Streaming XML using LINQ to XML (continued)</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,ae42c4b4-4d6e-464e-98e0-c430ea35b4ab.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/11/01/StreamingXMLUsingLINQToXMLContinued.aspx</link>
      <pubDate>Tue, 01 Nov 2011 15:34:36 GMT</pubDate>
      <description>&lt;p&gt;
Richard Blewett reminded me that the XmlReader.ReadSubtree method makes it even easier
to use LINQ to XML with a streaming approach. The code sample below will load nodes
from an arbitrary XML files and yield them to the caller as they’re read from file:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;static&lt;/span&gt; IEnumerable&amp;lt;XElement&amp;gt; Load(&lt;span class="kwrd"&gt;string&lt;/span&gt; filename, &lt;span class="kwrd"&gt;string&lt;/span&gt; elementName)&lt;/pre&gt;
&lt;pre&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;    XmlReaderSettings settings = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlReaderSettings();&lt;/pre&gt;
&lt;pre&gt;    settings.IgnoreWhitespace = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;using&lt;/span&gt; (XmlReader reader = XmlReader.Create(filename,
settings))&lt;/pre&gt;
&lt;pre&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;while&lt;/span&gt; (reader.ReadToFollowing(elementName))&lt;/pre&gt;
&lt;pre&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;            &lt;span class="rem"&gt;// build element from subtree&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;            XElement element = XElement.Load(reader.ReadSubtree());&lt;/pre&gt;
&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;yield&lt;/span&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; element;&lt;/pre&gt;
&lt;pre&gt;        }&lt;/pre&gt;
&lt;pre class="alt"&gt;    }&lt;/pre&gt;
&lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,ae42c4b4-4d6e-464e-98e0-c430ea35b4ab.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=76fc5c58-9545-4d17-b953-788033af34f2</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,76fc5c58-9545-4d17-b953-788033af34f2.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,76fc5c58-9545-4d17-b953-788033af34f2.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=76fc5c58-9545-4d17-b953-788033af34f2</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just rediscovered this blog post about reading and parsing XML as it becomes available
in conjunction with LINQ to XML: <a title="http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx" href="http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx">http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx</a></p>
        <p>
It’s a little dated, but still relevant <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Streaming-XML_DDD9/wlEmoticon-smile_2.png" />.
</p>
      </body>
      <title>Streaming XML</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,76fc5c58-9545-4d17-b953-788033af34f2.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/10/31/StreamingXML.aspx</link>
      <pubDate>Mon, 31 Oct 2011 22:48:11 GMT</pubDate>
      <description>&lt;p&gt;
I just rediscovered this blog post about reading and parsing XML as it becomes available
in conjunction with LINQ to XML: &lt;a title="http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx" href="http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx"&gt;http://blogs.msdn.com/b/xmlteam/archive/2007/03/24/streaming-with-linq-to-xml-part-2.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
It’s a little dated, but still relevant &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Streaming-XML_DDD9/wlEmoticon-smile_2.png" /&gt;.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,76fc5c58-9545-4d17-b953-788033af34f2.aspx</comments>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=ee85e660-a94b-41db-9fe5-5f4bc8ef1d8b</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,ee85e660-a94b-41db-9fe5-5f4bc8ef1d8b.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,ee85e660-a94b-41db-9fe5-5f4bc8ef1d8b.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ee85e660-a94b-41db-9fe5-5f4bc8ef1d8b</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just came across this great picture of what’s new in .NET Framework 4.5 (click for
larger version):
</p>
        <p>
          <a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Whats-new-in-.NET-Framework-4.5_5A7E/WhatsNewNET45-en_2.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WhatsNewNET45-en" border="0" alt="WhatsNewNET45-en" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Whats-new-in-.NET-Framework-4.5_5A7E/WhatsNewNET45-en_thumb.png" width="644" height="457" />
          </a>
        </p>
      </body>
      <title>What’s new in .NET Framework 4.5</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,ee85e660-a94b-41db-9fe5-5f4bc8ef1d8b.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/10/31/WhatsNewInNETFramework45.aspx</link>
      <pubDate>Mon, 31 Oct 2011 13:27:48 GMT</pubDate>
      <description>&lt;p&gt;
Just came across this great picture of what’s new in .NET Framework 4.5 (click for
larger version):
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Whats-new-in-.NET-Framework-4.5_5A7E/WhatsNewNET45-en_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="WhatsNewNET45-en" border="0" alt="WhatsNewNET45-en" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Whats-new-in-.NET-Framework-4.5_5A7E/WhatsNewNET45-en_thumb.png" width="644" height="457" /&gt;&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,ee85e660-a94b-41db-9fe5-5f4bc8ef1d8b.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET</category>
      <category>C#</category>
      <category>LINQ</category>
      <category>VB.NET</category>
      <category>WCF</category>
      <category>WF</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=fb42d0aa-aa08-46f4-abad-77df7f8773e7</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,fb42d0aa-aa08-46f4-abad-77df7f8773e7.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,fb42d0aa-aa08-46f4-abad-77df7f8773e7.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=fb42d0aa-aa08-46f4-abad-77df7f8773e7</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was implementing a client report (RDLC) using the Microsoft Report Viewer control
and I wanted to set the background color of a table field based on value from my object
source. At first I used the Color.ToKnownColor() method, but discovered that this
does not work for all colors. I needed to convert to Hex. Here is the little extension
method I used:
</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: 90%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; 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; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">static</span>
              <span style="color: #0000ff">class</span> ColorExtensions</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">{</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #cc6633">#region</span> --
Data Members --</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">static</span>
              <span style="color: #0000ff">char</span>[]
hexDigits = {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #006080">'0'</span>, <span style="color: #006080">'1'</span>, <span style="color: #006080">'2'</span>, <span style="color: #006080">'3'</span>, <span style="color: #006080">'4'</span>, <span style="color: #006080">'5'</span>, <span style="color: #006080">'6'</span>, <span style="color: #006080">'7'</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #006080">'8'</span>, <span style="color: #006080">'9'</span>, <span style="color: #006080">'A'</span>, <span style="color: #006080">'B'</span>, <span style="color: #006080">'C'</span>, <span style="color: #006080">'D'</span>, <span style="color: #006080">'E'</span>, <span style="color: #006080">'F'</span>};</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #cc6633">#endregion</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">///
&lt;summary&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">///
Convert a .NET Color to a hex string.</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">///
&lt;/summary&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">///
&lt;returns&gt;ex: "#FFFFFF", "#554ECE"&lt;/returns&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">static</span>
              <span style="color: #0000ff">string</span> ToHexString( <span style="color: #0000ff">this</span> Color
color )</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">byte</span>[]
bytes = <span style="color: #0000ff">new</span><span style="color: #0000ff">byte</span>[3];</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        bytes[0] = color.R;</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        bytes[1] = color.G;</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        bytes[2] = color.B;</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">char</span>[]
chars = <span style="color: #0000ff">new</span><span style="color: #0000ff">char</span>[bytes.Length
* 2];</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">for</span> ( <span style="color: #0000ff">int</span> i
= 0; i &lt; bytes.Length; i++ )</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        {</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">int</span> b
= bytes[i];</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            chars[i * 2] = hexDigits[b &gt;&gt; 4];</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">            chars[i * 2 + 1] = hexDigits[b &amp; 0xF];</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">        }</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">return</span>
              <span style="color: #006080">"#"</span> + <span style="color: #0000ff">new</span><span style="color: #0000ff">string</span>(
chars );</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    }</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">}</pre>
            <!--CRLF-->
          </div>
        </div>
      </body>
      <title>Custom color in reports : convert color to Hex</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,fb42d0aa-aa08-46f4-abad-77df7f8773e7.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/10/21/CustomColorInReportsConvertColorToHex.aspx</link>
      <pubDate>Fri, 21 Oct 2011 11:41:55 GMT</pubDate>
      <description>&lt;p&gt;
I was implementing a client report (RDLC) using the Microsoft Report Viewer control
and I wanted to set the background color of a table field based on value from my object
source. At first I used the Color.ToKnownColor() method, but discovered that this
does not work for all colors. I needed to convert to Hex. Here is the little extension
method I used:
&lt;/p&gt;
&lt;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: 90%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ColorExtensions&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #cc6633"&gt;#region&lt;/span&gt; --
Data Members --&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;[]
hexDigits = {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #006080"&gt;'0'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'1'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'2'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'3'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'4'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'5'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'6'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'7'&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #006080"&gt;'8'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'9'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'A'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'B'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'C'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'D'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'E'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'F'&lt;/span&gt;};&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #cc6633"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;///
Convert a .NET Color to a hex string.&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;///
&amp;lt;returns&amp;gt;ex: &amp;quot;#FFFFFF&amp;quot;, &amp;quot;#554ECE&amp;quot;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; ToHexString( &lt;span style="color: #0000ff"&gt;this&lt;/span&gt; Color
color )&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;byte&lt;/span&gt;[]
bytes = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;byte&lt;/span&gt;[3];&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        bytes[0] = color.R;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        bytes[1] = color.G;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        bytes[2] = color.B;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;[]
chars = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;[bytes.Length
* 2];&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; ( &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i
= 0; i &amp;lt; bytes.Length; i++ )&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; b
= bytes[i];&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            chars[i * 2] = hexDigits[b &amp;gt;&amp;gt; 4];&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            chars[i * 2 + 1] = hexDigits[b &amp;amp; 0xF];&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #006080"&gt;&amp;quot;#&amp;quot;&lt;/span&gt; + &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;(
chars );&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,fb42d0aa-aa08-46f4-abad-77df7f8773e7.aspx</comments>
      <category>.NET</category>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=5b290b3d-3487-48c6-bf18-5fc1882f6200</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,5b290b3d-3487-48c6-bf18-5fc1882f6200.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,5b290b3d-3487-48c6-bf18-5fc1882f6200.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5b290b3d-3487-48c6-bf18-5fc1882f6200</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just ran into an issue where I have a WCF service that depends on a .NET assembly
that is compiled specifically for x86. In order to use that assembly I need to compile
the service as a x86 service. No problem, but now when I want to test or add a service
reference to this WCF service I ran into the problem that WcfSvcHost and WcfTestClient
both will run a x64 because I’m running Windows 7 x64.
</p>
        <p>
How to solve this? I found the answer in the <a href="http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/2e29a4aa-e587-43ef-bf50-329b7cd3eefb" target="_blank">forums</a> and
adapted the answer for my specific problem:
</p>
        <p>
1.Copy WcfSvcHost.exe and WcfTestClient.exe from C:\program files (x86)\Microsoft
Visual Studio 10.0\Common7\IDE to a local directory. Keep a backup copy of this file,
of course. 
<br />
2.Start a Visual Studio 2010 Command Prompt (one of the links from the start menu
-&gt; Visaul Studio 2010) 
<br />
3."cd" to the directory where your copy of WcfSvcHost is located. 
<br />
4.Execute the command "corflags /32BIT+ /FORCE WcfSvcHost.exe" 
<br />
5.Copy the files back to where you found it. 
<br />
  
<br />
Now your WcfSvcHost and WcfTestClient will be running in 32 bit mode.
</p>
      </body>
      <title>Visual Studio 2010: Debugging a x86 WCF service on a x64 machine</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,5b290b3d-3487-48c6-bf18-5fc1882f6200.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/10/05/VisualStudio2010DebuggingAX86WCFServiceOnAX64Machine.aspx</link>
      <pubDate>Wed, 05 Oct 2011 18:28:04 GMT</pubDate>
      <description>&lt;p&gt;
I just ran into an issue where I have a WCF service that depends on a .NET assembly
that is compiled specifically for x86. In order to use that assembly I need to compile
the service as a x86 service. No problem, but now when I want to test or add a service
reference to this WCF service I ran into the problem that WcfSvcHost and WcfTestClient
both will run a x64 because I’m running Windows 7 x64.
&lt;/p&gt;
&lt;p&gt;
How to solve this? I found the answer in the &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/2e29a4aa-e587-43ef-bf50-329b7cd3eefb" target="_blank"&gt;forums&lt;/a&gt; and
adapted the answer for my specific problem:
&lt;/p&gt;
&lt;p&gt;
1.Copy WcfSvcHost.exe and WcfTestClient.exe from C:\program files (x86)\Microsoft
Visual Studio 10.0\Common7\IDE to a local directory. Keep a backup copy of this file,
of course. 
&lt;br /&gt;
2.Start a Visual Studio 2010 Command Prompt (one of the links from the start menu
-&amp;gt; Visaul Studio 2010) 
&lt;br /&gt;
3.&amp;quot;cd&amp;quot; to the directory where your copy of WcfSvcHost is located. 
&lt;br /&gt;
4.Execute the command &amp;quot;corflags /32BIT+ /FORCE WcfSvcHost.exe&amp;quot; 
&lt;br /&gt;
5.Copy the files back to where you found it. 
&lt;br /&gt;
&amp;#160; 
&lt;br /&gt;
Now your WcfSvcHost and WcfTestClient will be running in 32 bit mode.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,5b290b3d-3487-48c6-bf18-5fc1882f6200.aspx</comments>
      <category>Visual Studio 2010</category>
      <category>WCF</category>
      <category>Windows 7</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=52e8968d-6141-45ab-8161-54735dd3841c</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,52e8968d-6141-45ab-8161-54735dd3841c.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,52e8968d-6141-45ab-8161-54735dd3841c.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=52e8968d-6141-45ab-8161-54735dd3841c</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a title="Omnext.NET bv - The Netherlands" href="http://www.omnext.net/lang/eng" target="_blank">Omnext</a> was
part of a Dutch trade delegation visiting the New York CloudExpo 2011. 
<br />
Here is a link to a great article by Theo Loth (coordinator <a href="http://www.eurocloudnl.eu/" target="_blank">EuroCloud
Nederland</a>) about the event: <a title="omnext - cloudexpo 2011.pdf" href="http://www.develop-one.net/home/downloads/omnext%20-%20cloudexpo%202011.pdf">omnext
- cloudexpo 2011.pdf</a> (in Dutch).
</p>
        <p>
If your looking to find out more about Omnext and how Source2VALUE can help improve
the ROI of your software development investments, then visit <a href="http://www.omnext.net">www.omnext.net</a> or
talk to Jaco and Andre at the <a href="http://www.eoasummit.com/summit/" target="_blank">2011
European Outsourcing Summit</a> in Madrid, Spain.
</p>
      </body>
      <title>Omnext @ New York CloudExpo 2011: “If it ain’t Dutch, it ain’t much”</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,52e8968d-6141-45ab-8161-54735dd3841c.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/09/02/OmnextNewYorkCloudExpo2011IfItAintDutchItAintMuch.aspx</link>
      <pubDate>Fri, 02 Sep 2011 12:37:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a title="Omnext.NET bv - The Netherlands" href="http://www.omnext.net/lang/eng" target="_blank"&gt;Omnext&lt;/a&gt; was
part of a Dutch trade delegation visiting the New York CloudExpo 2011. 
&lt;br /&gt;
Here is a link to a great article by Theo Loth (coordinator &lt;a href="http://www.eurocloudnl.eu/" target="_blank"&gt;EuroCloud
Nederland&lt;/a&gt;) about the event: &lt;a title="omnext - cloudexpo 2011.pdf" href="http://www.develop-one.net/home/downloads/omnext%20-%20cloudexpo%202011.pdf"&gt;omnext
- cloudexpo 2011.pdf&lt;/a&gt; (in Dutch).
&lt;/p&gt;
&lt;p&gt;
If your looking to find out more about Omnext and how Source2VALUE can help improve
the ROI of your software development investments, then visit &lt;a href="http://www.omnext.net"&gt;www.omnext.net&lt;/a&gt; or
talk to Jaco and Andre at the &lt;a href="http://www.eoasummit.com/summit/" target="_blank"&gt;2011
European Outsourcing Summit&lt;/a&gt; in Madrid, Spain.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,52e8968d-6141-45ab-8161-54735dd3841c.aspx</comments>
      <category>Azure</category>
      <category>Cloud</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=389f0b4b-e14d-49b0-be2b-c0809f4bd280</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,389f0b4b-e14d-49b0-be2b-c0809f4bd280.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,389f0b4b-e14d-49b0-be2b-c0809f4bd280.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=389f0b4b-e14d-49b0-be2b-c0809f4bd280</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For those who will be in the Netherlands in October: the <a title="Software Developer Network" href="http://www.sdn.nl" target="_blank">SDN</a> is
organizing it’s annual 2-day conference on October 3rd and 4th, 2011. A preview of
the schedule is now online and registration has just opened: <a title="http://www.sdn.nl/SDN/SDNEvent/SDNConferences2011/tabid/162/Default.aspx" href="http://www.sdn.nl/SDN/SDNEvent/SDNConferences2011/tabid/162/Default.aspx">http://www.sdn.nl/SDN/SDNEvent/SDNConferences2011/tabid/162/Default.aspx</a></p>
      </body>
      <title>SDN Conferences 2011</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,389f0b4b-e14d-49b0-be2b-c0809f4bd280.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/08/26/SDNConferences2011.aspx</link>
      <pubDate>Fri, 26 Aug 2011 12:11:14 GMT</pubDate>
      <description>&lt;p&gt;
For those who will be in the Netherlands in October: the &lt;a title="Software Developer Network" href="http://www.sdn.nl" target="_blank"&gt;SDN&lt;/a&gt; is
organizing it’s annual 2-day conference on October 3rd and 4th, 2011. A preview of
the schedule is now online and registration has just opened: &lt;a title="http://www.sdn.nl/SDN/SDNEvent/SDNConferences2011/tabid/162/Default.aspx" href="http://www.sdn.nl/SDN/SDNEvent/SDNConferences2011/tabid/162/Default.aspx"&gt;http://www.sdn.nl/SDN/SDNEvent/SDNConferences2011/tabid/162/Default.aspx&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,389f0b4b-e14d-49b0-be2b-c0809f4bd280.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=d8442f6f-10f8-4b23-9336-9c1f5d36ac36</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,d8442f6f-10f8-4b23-9336-9c1f5d36ac36.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,d8442f6f-10f8-4b23-9336-9c1f5d36ac36.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d8442f6f-10f8-4b23-9336-9c1f5d36ac36</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A (short) video impression of Maine Code Camp #2:
</p>
        <iframe width="560" height="349" src="http://www.youtube.com/embed/nAyqxOQgk50" frameborder="0" allowfullscreen="allowfullscreen">
        </iframe>
      </body>
      <title>Maine Code Camp #2 - Video Impression</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,d8442f6f-10f8-4b23-9336-9c1f5d36ac36.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/08/01/MaineCodeCamp2VideoImpression.aspx</link>
      <pubDate>Mon, 01 Aug 2011 13:11:03 GMT</pubDate>
      <description>&lt;p&gt;
A (short) video impression of Maine Code Camp #2:
&lt;/p&gt;
&lt;iframe width="560" height="349" src="http://www.youtube.com/embed/nAyqxOQgk50" frameborder="0" allowfullscreen&gt;
&lt;/iframe&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,d8442f6f-10f8-4b23-9336-9c1f5d36ac36.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=26511de4-79f4-48ff-b231-ba879a8a25de</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,26511de4-79f4-48ff-b231-ba879a8a25de.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,26511de4-79f4-48ff-b231-ba879a8a25de.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=26511de4-79f4-48ff-b231-ba879a8a25de</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Suppose I have a list of time cards from multiple employees, but I want to group them
into dictionary, based on the Social Security Number (SSN) of the employee. Here is
an example of how to convert a list of items into a dictionary of lists: 
<br /></p>
        <div class="csharpcode">
          <pre class="alt">Dictionary&lt;<span class="kwrd">string</span>, List&lt;TimeCardInfo&gt;&gt;
dict;</pre>
          <pre> </pre>
          <pre class="alt">dict = ( from timecard <span class="kwrd">in</span> listOfTimeCards</pre>
          <pre>         group timecard by timecard.SSN ).ToDictionary( x =&gt; x.Key, x =&gt; x.ToList() );</pre>
        </div>
        <style type="text/css">

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
      </body>
      <title>LINQ: Convert list to a dictionary of lists</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,26511de4-79f4-48ff-b231-ba879a8a25de.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/07/11/LINQConvertListToADictionaryOfLists.aspx</link>
      <pubDate>Mon, 11 Jul 2011 13:49:14 GMT</pubDate>
      <description>&lt;p&gt;
Suppose I have a list of time cards from multiple employees, but I want to group them
into dictionary, based on the Social Security Number (SSN) of the employee. Here is
an example of how to convert a list of items into a dictionary of lists: 
&lt;br /&gt;
&lt;/p&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, List&amp;lt;TimeCardInfo&amp;gt;&amp;gt;
dict;&lt;/pre&gt;
&lt;pre&gt;&amp;#160;&lt;/pre&gt;
&lt;pre class="alt"&gt;dict = ( from timecard &lt;span class="kwrd"&gt;in&lt;/span&gt; listOfTimeCards&lt;/pre&gt;
&lt;pre&gt;         group timecard by timecard.SSN ).ToDictionary( x =&amp;gt; x.Key, x =&amp;gt; x.ToList() );&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,26511de4-79f4-48ff-b231-ba879a8a25de.aspx</comments>
      <category>C#</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=190be556-b1c6-419e-aac4-7781be9f0a43</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,190be556-b1c6-419e-aac4-7781be9f0a43.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,190be556-b1c6-419e-aac4-7781be9f0a43.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=190be556-b1c6-419e-aac4-7781be9f0a43</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <div id="codeSnippetWrapper">I just discovered that if you run SQL Server on your
developer box and never bother to cleanup your log files, then perhaps they get to
be a little big <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Shrink-SQL-Server-2008-R2-log-files_7271/wlEmoticon-smile_2.png" />. 
<br />
Here is a script to quickly shrink a log file:
</div>
        <div> 
</div>
        <div> 
</div>
        <div class="csharpcode">
          <pre class="alt">
            <span class="kwrd">Use</span> [YourDatabaseName]</pre>
          <pre>
            <span class="kwrd">Go</span>
          </pre>
          <pre class="alt"> </pre>
          <pre>
            <span class="kwrd">select</span> name,recovery_model_desc <span class="kwrd">from</span> sys.databases</pre>
          <pre class="alt">
            <span class="kwrd">GO</span>
          </pre>
          <pre>
            <span class="kwrd">Alter</span>
            <span class="kwrd">database</span> [YourDatabaseName] <span class="kwrd">SET</span> RECOVERY
SIMPLE</pre>
          <pre class="alt">
            <span class="kwrd">GO</span>
          </pre>
          <pre>
            <span class="kwrd">Declare</span> @LogFileLogicalName sysname</pre>
          <pre class="alt">
            <span class="kwrd">select</span> @LogFileLogicalName=Name <span class="kwrd">from</span> sys.database_files <span class="kwrd">where</span> Type=1</pre>
          <pre>
            <span class="kwrd">print</span> @LogFileLogicalName</pre>
          <pre class="alt"> </pre>
          <pre>
            <span class="kwrd">DBCC</span> Shrinkfile(@LogFileLogicalName,100) </pre>
        </div>
        <style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
      </body>
      <title>Shrink SQL Server 2008 R2 log files</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,190be556-b1c6-419e-aac4-7781be9f0a43.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/07/08/ShrinkSQLServer2008R2LogFiles.aspx</link>
      <pubDate>Fri, 08 Jul 2011 12:12:15 GMT</pubDate>
      <description>&lt;div id="codeSnippetWrapper"&gt;I just discovered that if you run SQL Server on your
developer box and never bother to cleanup your log files, then perhaps they get to
be a little big &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Shrink-SQL-Server-2008-R2-log-files_7271/wlEmoticon-smile_2.png" /&gt;. 
&lt;br /&gt;
Here is a script to quickly shrink a log file:
&lt;/div&gt;
&lt;div&gt;&amp;#160;
&lt;/div&gt;
&lt;div&gt;&amp;#160;
&lt;/div&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;Use&lt;/span&gt; [YourDatabaseName]&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;Go&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;select&lt;/span&gt; name,recovery_model_desc &lt;span class="kwrd"&gt;from&lt;/span&gt; sys.databases&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;GO&lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;Alter&lt;/span&gt; &lt;span class="kwrd"&gt;database&lt;/span&gt; [YourDatabaseName] &lt;span class="kwrd"&gt;SET&lt;/span&gt; RECOVERY
SIMPLE&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;GO&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;Declare&lt;/span&gt; @LogFileLogicalName sysname&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;select&lt;/span&gt; @LogFileLogicalName=Name &lt;span class="kwrd"&gt;from&lt;/span&gt; sys.database_files &lt;span class="kwrd"&gt;where&lt;/span&gt; Type=1&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;print&lt;/span&gt; @LogFileLogicalName&lt;/pre&gt;
&lt;pre class="alt"&gt;&amp;#160;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="kwrd"&gt;DBCC&lt;/span&gt; Shrinkfile(@LogFileLogicalName,100) &lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,190be556-b1c6-419e-aac4-7781be9f0a43.aspx</comments>
      <category>SQL</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=340103f1-c92a-4318-ab1a-4db670424fac</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,340103f1-c92a-4318-ab1a-4db670424fac.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,340103f1-c92a-4318-ab1a-4db670424fac.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=340103f1-c92a-4318-ab1a-4db670424fac</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the model below the phone number for an artist is actually a complex type (a little
over engineered, I know, but I was just exploring how well this works).
</p>
        <p>
          <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Fram_7641/image_5.png" width="611" height="519" />
        </p>
        <p>
The complex type consists of 4 ‘fields’: CountryCode, AreaCode, Number and Extension:
</p>
        <p>
          <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Fram_7641/image_8.png" width="298" height="306" />
        </p>
        <p>
Each ‘field’ has properties set:
</p>
        <p>
          <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Fram_7641/image_11.png" width="345" height="298" />
        </p>
        <p>
The great part is that this is fully supported by the DDL generator, so right click
on the Entity Framework Designer in Visual Studio 2010 and choose ‘Generate Database
From Model…’ and the ‘Artist’ table will be generated as:
</p>
        <div id="codeSnippetWrapper">
          <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
Entity Designer DDL Script for SQL Server 2005, 2008, and Azure</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
Creating all tables</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
Creating table 'Artists'</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">CREATE</span>
              <span style="color: #0000ff">TABLE</span> [dbo].[Artists]
(</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Id] <span style="color: #0000ff">int</span><span style="color: #0000ff">IDENTITY</span>(1,1) <span style="color: #0000ff">NOT</span><span style="color: #0000ff">NULL</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Name] nvarchar(100)  <span style="color: #0000ff">NOT</span><span style="color: #0000ff">NULL</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [IsIndividual] <span style="color: #0000ff">bit</span><span style="color: #0000ff">NOT</span><span style="color: #0000ff">NULL</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Phone_CountryCode] nvarchar(4)  <span style="color: #0000ff">NOT</span><span style="color: #0000ff">NULL</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Phone_AreaCode] nvarchar(5)  <span style="color: #0000ff">NOT</span><span style="color: #0000ff">NULL</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Phone_Number] nvarchar(10)  <span style="color: #0000ff">NOT</span><span style="color: #0000ff">NULL</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">    [Phone_Extension] nvarchar(10)  <span style="color: #0000ff">NULL</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">);</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">GO</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
&lt;snip other tables&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
Creating all PRIMARY KEY constraints</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
Creating primary key on [Id] in table 'Artists'</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">ALTER</span>
              <span style="color: #0000ff">TABLE</span> [dbo].[Artists]</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">ADD</span>
              <span style="color: #0000ff">CONSTRAINT</span> [PK_Artists]</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">PRIMARY</span>
              <span style="color: #0000ff">KEY</span>
              <span style="color: #0000ff">CLUSTERED</span> ([Id] <span style="color: #0000ff">ASC</span>);</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">GO</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
&lt;snip other primary and foreign key&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
--------------------------------------------------</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #008000">--
Script has ended</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">-- --------------------------------------------------</pre>
            <!--CRLF-->
          </div>
        </div>
Notice that by default each column is prefixed with the name of the complex type,
this is of course needed to ensure column names stay unique across multiple complex
types in a single entity. 
</body>
      <title>Entity Framework – Model First: Generating DDL for Complex Types</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,340103f1-c92a-4318-ab1a-4db670424fac.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/07/02/EntityFrameworkModelFirstGeneratingDDLForComplexTypes.aspx</link>
      <pubDate>Sat, 02 Jul 2011 07:35:11 GMT</pubDate>
      <description>&lt;p&gt;
In the model below the phone number for an artist is actually a complex type (a little
over engineered, I know, but I was just exploring how well this works).
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Fram_7641/image_5.png" width="611" height="519" /&gt;
&lt;/p&gt;
&lt;p&gt;
The complex type consists of 4 ‘fields’: CountryCode, AreaCode, Number and Extension:
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Fram_7641/image_8.png" width="298" height="306" /&gt;
&lt;/p&gt;
&lt;p&gt;
Each ‘field’ has properties set:
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Fram_7641/image_11.png" width="345" height="298" /&gt;
&lt;/p&gt;
&lt;p&gt;
The great part is that this is fully supported by the DDL generator, so right click
on the Entity Framework Designer in Visual Studio 2010 and choose ‘Generate Database
From Model…’ and the ‘Artist’ table will be generated as:
&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
Entity Designer DDL Script for SQL Server 2005, 2008, and Azure&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
Creating all tables&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
Creating table 'Artists'&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt; [dbo].[Artists]
(&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Id] &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; &lt;span style="color: #0000ff"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Name] nvarchar(100)  &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [IsIndividual] &lt;span style="color: #0000ff"&gt;bit&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Phone_CountryCode] nvarchar(4)  &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Phone_AreaCode] nvarchar(5)  &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Phone_Number] nvarchar(10)  &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Phone_Extension] nvarchar(10)  &lt;span style="color: #0000ff"&gt;NULL&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
&amp;lt;snip other tables&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
Creating all PRIMARY KEY constraints&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
Creating primary key on [Id] in table 'Artists'&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;ALTER&lt;/span&gt; &lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt; [dbo].[Artists]&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;ADD&lt;/span&gt; &lt;span style="color: #0000ff"&gt;CONSTRAINT&lt;/span&gt; [PK_Artists]&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;PRIMARY&lt;/span&gt; &lt;span style="color: #0000ff"&gt;KEY&lt;/span&gt; &lt;span style="color: #0000ff"&gt;CLUSTERED&lt;/span&gt; ([Id] &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
&amp;lt;snip other primary and foreign key&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
--------------------------------------------------&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #008000"&gt;--
Script has ended&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;-- --------------------------------------------------&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
Notice that by default each column is prefixed with the name of the complex type, this is of course needed to ensure column names stay unique across multiple complex types in a single entity.










</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,340103f1-c92a-4318-ab1a-4db670424fac.aspx</comments>
      <category>.NET</category>
      <category>C#</category>
      <category>Entity Framework</category>
      <category>Visual Studio 2010</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=f9db7249-abff-4145-8cc4-c8e423d7c68b</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,f9db7249-abff-4145-8cc4-c8e423d7c68b.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,f9db7249-abff-4145-8cc4-c8e423d7c68b.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f9db7249-abff-4145-8cc4-c8e423d7c68b</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you’re using the Entity Framework and don’t want to implement ToTraceString() at
strategic points in your code in order to see what kind of SQL statements are getting
generated then check out one of the following:
</p>
        <ul>
          <li>
Community Entity Framework Provider Wrappers (free) 
<ul><li><a href="http://efwrappers.codeplex.com">http://efwrappers.codeplex.com</a><a href="http://efwrappers.codeplex.com/">/</a></li><li>
Or use NuGet: 
<ul><li>
Install-Package CommunityEFProviderWrappers.EFTracingProvider 
</li></ul></li></ul></li>
          <li>
Entity Framework Profiler 
</li>
          <ul>
            <li>
              <a title="http://efprof.com/" href="http://efprof.com/">http://efprof.com/</a>
            </li>
          </ul>
          <li>
SQL Server Profiler</li>
          <ul>
            <li>
More info on setting up SQL Server Profiler: <a href="http://blog.tonysneed.com/2010/08/05/setting-up-sql-server-2008-express-with-profiler">http://blog.tonysneed.com/2010/08/05/setting-up-sql-server-2008-express-with-profiler</a></li>
          </ul>
        </ul>
        <p>
          <em>Update 07-02-2011: Added SQL Server Profiler after comment by Tony Sneed.</em>
        </p>
      </body>
      <title>Logging and tracing with Entity Framework</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,f9db7249-abff-4145-8cc4-c8e423d7c68b.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/06/29/LoggingAndTracingWithEntityFramework.aspx</link>
      <pubDate>Wed, 29 Jun 2011 13:07:03 GMT</pubDate>
      <description>&lt;p&gt;
If you’re using the Entity Framework and don’t want to implement ToTraceString() at
strategic points in your code in order to see what kind of SQL statements are getting
generated then check out one of the following:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Community Entity Framework Provider Wrappers (free) 
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://efwrappers.codeplex.com"&gt;http://efwrappers.codeplex.com&lt;/a&gt;&lt;a href="http://efwrappers.codeplex.com/"&gt;/&lt;/a&gt; 
&lt;/li&gt;
&lt;li&gt;
Or use NuGet: 
&lt;ul&gt;
&lt;li&gt;
Install-Package CommunityEFProviderWrappers.EFTracingProvider 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Entity Framework Profiler 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a title="http://efprof.com/" href="http://efprof.com/"&gt;http://efprof.com/&lt;/a&gt; 
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
SQL Server Profiler&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
More info on setting up SQL Server Profiler: &lt;a href="http://blog.tonysneed.com/2010/08/05/setting-up-sql-server-2008-express-with-profiler"&gt;http://blog.tonysneed.com/2010/08/05/setting-up-sql-server-2008-express-with-profiler&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;em&gt;Update 07-02-2011: Added SQL Server Profiler after comment by Tony Sneed.&lt;/em&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,f9db7249-abff-4145-8cc4-c8e423d7c68b.aspx</comments>
      <category>Entity Framework</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=af239c48-5587-489a-97d1-9063f78c6fa8</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,af239c48-5587-489a-97d1-9063f78c6fa8.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,af239c48-5587-489a-97d1-9063f78c6fa8.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=af239c48-5587-489a-97d1-9063f78c6fa8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you’re doing Model First with Entity Framework you may run into a scenario where
you want to design a 1-to-1 relationship, but also have a foreign key be available
on your entity. The default behavior in Entity Framework when doing a 1-to-1 relationship
(with Model First), or 1-to-0..1 relationship, is to create a foreign key on the 0..1
side of the association but hide the foreign key. A better approach is this:
</p>
        <ul>
          <li>
Start a new model</li>
          <li>
Add the entity that goes on the 1 side of the association, give it a primary key of
type integer. Make sure the StoreGeneratedPattern property is set to <strong>Identity</strong>.</li>
          <li>
Add the entity that goes on the 0..1 side of the assocation, name the primary key
as you would a foreign key, make it of type integer. Make sure the StoreGeneratedPattern
property is set to <strong>None</strong>. 
<br /><a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_thumb_1.png" width="301" height="237" /></a></li>
          <li>
Click on the 1 entity and add an association, make it a 1-to-0..1, example: 
<br /><a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_6.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_thumb_2.png" width="359" height="152" /></a></li>
          <li>
Double click the association and set a referential constraint. 
<br /><a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_thumb.png" width="362" height="209" /></a></li>
          <li>
Now you’re ready to generate your database schema.</li>
        </ul>
      </body>
      <title>Entity Framework - Model First: One-to-One relationship</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,af239c48-5587-489a-97d1-9063f78c6fa8.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/06/29/EntityFrameworkModelFirstOnetoOneRelationship.aspx</link>
      <pubDate>Wed, 29 Jun 2011 07:35:03 GMT</pubDate>
      <description>&lt;p&gt;
If you’re doing Model First with Entity Framework you may run into a scenario where
you want to design a 1-to-1 relationship, but also have a foreign key be available
on your entity. The default behavior in Entity Framework when doing a 1-to-1 relationship
(with Model First), or 1-to-0..1 relationship, is to create a foreign key on the 0..1
side of the association but hide the foreign key. A better approach is this:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Start a new model&lt;/li&gt;
&lt;li&gt;
Add the entity that goes on the 1 side of the association, give it a primary key of
type integer. Make sure the StoreGeneratedPattern property is set to &lt;strong&gt;Identity&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
Add the entity that goes on the 0..1 side of the assocation, name the primary key
as you would a foreign key, make it of type integer. Make sure the StoreGeneratedPattern
property is set to &lt;strong&gt;None&lt;/strong&gt;. 
&lt;br /&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_thumb_1.png" width="301" height="237" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Click on the 1 entity and add an association, make it a 1-to-0..1, example: 
&lt;br /&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_thumb_2.png" width="359" height="152" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Double click the association and set a referential constraint. 
&lt;br /&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Entity-Framework---Model-First-One-to-On_74BA/image_thumb.png" width="362" height="209" /&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
Now you’re ready to generate your database schema.&lt;/li&gt;
&lt;/ul&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,af239c48-5587-489a-97d1-9063f78c6fa8.aspx</comments>
      <category>Entity Framework</category>
      <category>LINQ</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=b8303854-f77c-44e4-a12a-eb8377a98463</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,b8303854-f77c-44e4-a12a-eb8377a98463.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,b8303854-f77c-44e4-a12a-eb8377a98463.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b8303854-f77c-44e4-a12a-eb8377a98463</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Here is a script for getting size information on every table in your SQL Server database.
Based on a script by <a href="http://www.mitchelsellers.com/blogs/articletype/articleview/articleid/121/determing-sql-server-table-size.aspx" target="_blank">Mitchell
Sellers</a>, this script also works if you have multiple schemas in your database:
</p>
        <div id="codeSnippetWrapper">
          <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet">
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">DECLARE</span> @TableName <span style="color: #0000ff">VARCHAR</span>(100)
--<span style="color: #0000ff">For</span> storing <span style="color: #0000ff">values</span><span style="color: #0000ff">in</span> the <span style="color: #0000ff">cursor</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> --<span style="color: #0000ff">Cursor</span><span style="color: #0000ff">to</span><span style="color: #0000ff">get</span> the
name <span style="color: #0000ff">of</span><span style="color: #0000ff">all</span><span style="color: #0000ff">user</span> tables <span style="color: #0000ff">from</span> the
sysobjects listing</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">DECLARE</span> tableCursor <span style="color: #0000ff">CURSOR</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">FOR</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">SELECT</span>
              <span style="color: #006080">'['</span>+SCHEMA_NAME(schema_id)+<span style="color: #006080">'].['</span>+name+<span style="color: #006080">']'</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">AS</span> SchemaTable</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">FROM</span> sys.tables <span style="color: #0000ff">where</span> type_desc
= <span style="color: #006080">'USER_TABLE'</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">FOR</span>
              <span style="color: #0000ff">READ</span>
              <span style="color: #0000ff">ONLY</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--A <span style="color: #0000ff">procedure</span><span style="color: #0000ff">level</span> temp <span style="color: #0000ff">table</span><span style="color: #0000ff">to</span> store
the results</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">CREATE</span>
              <span style="color: #0000ff">TABLE</span> #TempTable</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> (</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     id <span style="color: #0000ff">int</span><span style="color: #0000ff">identity</span>,</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     tableName <span style="color: #0000ff">varchar</span>(100),</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     numberofRows <span style="color: #0000ff">varchar</span>(100),</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     reservedSize <span style="color: #0000ff">varchar</span>(50),</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     dataSize <span style="color: #0000ff">varchar</span>(50),</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     indexSize <span style="color: #0000ff">varchar</span>(50),</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     unusedSize <span style="color: #0000ff">varchar</span>(50)</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> )</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--<span style="color: #0000ff">Open</span> the <span style="color: #0000ff">cursor</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">OPEN</span> tableCursor</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--<span style="color: #0000ff">Get</span> the <span style="color: #0000ff">first</span><span style="color: #0000ff">table</span> name <span style="color: #0000ff">from</span> the <span style="color: #0000ff">cursor</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">FETCH</span>
              <span style="color: #0000ff">NEXT</span>
              <span style="color: #0000ff">FROM</span> tableCursor <span style="color: #0000ff">INTO</span> @TableName</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--Loop until the <span style="color: #0000ff">cursor</span> was <span style="color: #0000ff">not</span> able <span style="color: #0000ff">to</span><span style="color: #0000ff">fetch</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">WHILE</span> (@@Fetch_Status
&gt;= 0)</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">BEGIN</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     --<span style="color: #0000ff">Dump</span> the
results <span style="color: #0000ff">of</span> the sp_spaceused query <span style="color: #0000ff">to</span> the
temp <span style="color: #0000ff">table</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     INSERT  #TempTable</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">EXEC</span> sp_spaceused
@TableName</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">UPDATE</span> #TempTable <span style="color: #0000ff">set</span> tableName
= @TableName <span style="color: #0000ff">where</span> id = <span style="color: #cc6633">@@identity</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">     --<span style="color: #0000ff">Get</span> the <span style="color: #0000ff">next</span><span style="color: #0000ff">table</span> name</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">FETCH</span>
              <span style="color: #0000ff">NEXT</span>
              <span style="color: #0000ff">FROM</span> tableCursor <span style="color: #0000ff">INTO</span> @TableName</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">END</span>
            </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--<span style="color: #0000ff">Get</span> rid <span style="color: #0000ff">of</span> the <span style="color: #0000ff">cursor</span></pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">CLOSE</span> tableCursor</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">DEALLOCATE</span> tableCursor</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--<span style="color: #0000ff">Select</span><span style="color: #0000ff">all</span> records
so we can <span style="color: #0000ff">use</span> the results</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">SELECT</span> * </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">FROM</span> #TempTable</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">ORDER</span>
              <span style="color: #0000ff">BY</span> tableName</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">--Final cleanup!</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">
              <span style="color: #0000ff">DROP</span>
              <span style="color: #0000ff">TABLE</span> #TempTable</pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"> </pre>
            <!--CRLF-->
            <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px">GO</pre>
            <!--CRLF-->
          </div>
        </div>
      </body>
      <title>SQL Server: Getting table size for all tables</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,b8303854-f77c-44e4-a12a-eb8377a98463.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/06/20/SQLServerGettingTableSizeForAllTables.aspx</link>
      <pubDate>Mon, 20 Jun 2011 13:14:26 GMT</pubDate>
      <description>&lt;p&gt;
Here is a script for getting size information on every table in your SQL Server database.
Based on a script by &lt;a href="http://www.mitchelsellers.com/blogs/articletype/articleview/articleid/121/determing-sql-server-table-size.aspx" target="_blank"&gt;Mitchell
Sellers&lt;/a&gt;, this script also works if you have multiple schemas in your database:
&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; @TableName &lt;span style="color: #0000ff"&gt;VARCHAR&lt;/span&gt;(100)
--&lt;span style="color: #0000ff"&gt;For&lt;/span&gt; storing &lt;span style="color: #0000ff"&gt;values&lt;/span&gt; &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; the &lt;span style="color: #0000ff"&gt;cursor&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt; --&lt;span style="color: #0000ff"&gt;Cursor&lt;/span&gt; &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; the
name &lt;span style="color: #0000ff"&gt;of&lt;/span&gt; &lt;span style="color: #0000ff"&gt;all&lt;/span&gt; &lt;span style="color: #0000ff"&gt;user&lt;/span&gt; tables &lt;span style="color: #0000ff"&gt;from&lt;/span&gt; the
sysobjects listing&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; tableCursor &lt;span style="color: #0000ff"&gt;CURSOR&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: #0000ff"&gt;FOR&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color: #006080"&gt;'['&lt;/span&gt;+SCHEMA_NAME(schema_id)+&lt;span style="color: #006080"&gt;'].['&lt;/span&gt;+name+&lt;span style="color: #006080"&gt;']'&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; SchemaTable&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; sys.tables &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; type_desc
= &lt;span style="color: #006080"&gt;'USER_TABLE'&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;FOR&lt;/span&gt; &lt;span style="color: #0000ff"&gt;READ&lt;/span&gt; &lt;span style="color: #0000ff"&gt;ONLY&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--A &lt;span style="color: #0000ff"&gt;procedure&lt;/span&gt; &lt;span style="color: #0000ff"&gt;level&lt;/span&gt; temp &lt;span style="color: #0000ff"&gt;table&lt;/span&gt; &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; store
the results&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt; #TempTable&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt; (&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     id &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; &lt;span style="color: #0000ff"&gt;identity&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     tableName &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(100),&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     numberofRows &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(100),&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     reservedSize &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(50),&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     dataSize &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(50),&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     indexSize &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(50),&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     unusedSize &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(50)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt; )&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--&lt;span style="color: #0000ff"&gt;Open&lt;/span&gt; the &lt;span style="color: #0000ff"&gt;cursor&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;OPEN&lt;/span&gt; tableCursor&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--&lt;span style="color: #0000ff"&gt;Get&lt;/span&gt; the &lt;span style="color: #0000ff"&gt;first&lt;/span&gt; &lt;span style="color: #0000ff"&gt;table&lt;/span&gt; name &lt;span style="color: #0000ff"&gt;from&lt;/span&gt; the &lt;span style="color: #0000ff"&gt;cursor&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;FETCH&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NEXT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; tableCursor &lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt; @TableName&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--Loop until the &lt;span style="color: #0000ff"&gt;cursor&lt;/span&gt; was &lt;span style="color: #0000ff"&gt;not&lt;/span&gt; able &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; &lt;span style="color: #0000ff"&gt;fetch&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;WHILE&lt;/span&gt; (@@Fetch_Status
&amp;gt;= 0)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     --&lt;span style="color: #0000ff"&gt;Dump&lt;/span&gt; the
results &lt;span style="color: #0000ff"&gt;of&lt;/span&gt; the sp_spaceused query &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; the
temp &lt;span style="color: #0000ff"&gt;table&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     INSERT  #TempTable&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;         &lt;span style="color: #0000ff"&gt;EXEC&lt;/span&gt; sp_spaceused
@TableName&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #0000ff"&gt;UPDATE&lt;/span&gt; #TempTable &lt;span style="color: #0000ff"&gt;set&lt;/span&gt; tableName
= @TableName &lt;span style="color: #0000ff"&gt;where&lt;/span&gt; id = &lt;span style="color: #cc6633"&gt;@@identity&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     --&lt;span style="color: #0000ff"&gt;Get&lt;/span&gt; the &lt;span style="color: #0000ff"&gt;next&lt;/span&gt; &lt;span style="color: #0000ff"&gt;table&lt;/span&gt; name&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;     &lt;span style="color: #0000ff"&gt;FETCH&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NEXT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; tableCursor &lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt; @TableName&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--&lt;span style="color: #0000ff"&gt;Get&lt;/span&gt; rid &lt;span style="color: #0000ff"&gt;of&lt;/span&gt; the &lt;span style="color: #0000ff"&gt;cursor&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;CLOSE&lt;/span&gt; tableCursor&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;DEALLOCATE&lt;/span&gt; tableCursor&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--&lt;span style="color: #0000ff"&gt;Select&lt;/span&gt; &lt;span style="color: #0000ff"&gt;all&lt;/span&gt; records
so we can &lt;span style="color: #0000ff"&gt;use&lt;/span&gt; the results&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; * &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; #TempTable&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;ORDER&lt;/span&gt; &lt;span style="color: #0000ff"&gt;BY&lt;/span&gt; tableName&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;--Final cleanup!&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;DROP&lt;/span&gt; &lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt; #TempTable&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;GO&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,b8303854-f77c-44e4-a12a-eb8377a98463.aspx</comments>
      <category>SQL</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=c2644c62-1826-433f-992d-5fe3aedef08a</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,c2644c62-1826-433f-992d-5fe3aedef08a.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,c2644c62-1826-433f-992d-5fe3aedef08a.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c2644c62-1826-433f-992d-5fe3aedef08a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The dates are set and confirmed! We have the <a href="http://www.stateparks.com/mount_blue.html">Mt.
Blue Campground</a> booked for July 29th and July 30th. We'll be tenting, presenting
and hanging out! If you're interested in speaking or attending the second Maine Code
Camp then please email: <a href="mailto:mark.blomsma@maine-devnet.org">mark.blomsma@maine-devnet.org</a>.
We'll be tenting, presenting and hanging out! More information to follow!
</p>
        <p>
Update: Just to be clear, the code camp will be Friday to Sunday from the 29th to
the 31st, with two nights spend at Mt. Blue State Park.
</p>
      </body>
      <title>Maine Code Camp #2</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,c2644c62-1826-433f-992d-5fe3aedef08a.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/06/13/MaineCodeCamp2.aspx</link>
      <pubDate>Mon, 13 Jun 2011 16:32:23 GMT</pubDate>
      <description>&lt;p&gt;
The dates are set and confirmed! We have the &lt;a href="http://www.stateparks.com/mount_blue.html"&gt;Mt.
Blue Campground&lt;/a&gt; booked for July 29th and July 30th. We'll be tenting, presenting
and hanging out! If you're interested in speaking or attending the second Maine Code
Camp then please email: &lt;a href="mailto:mark.blomsma@maine-devnet.org"&gt;mark.blomsma@maine-devnet.org&lt;/a&gt;.
We'll be tenting, presenting and hanging out! More information to follow!
&lt;/p&gt;
&lt;p&gt;
Update: Just to be clear, the code camp will be Friday to Sunday from the 29th to
the 31st, with two nights spend at Mt. Blue State Park.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,c2644c62-1826-433f-992d-5fe3aedef08a.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=9f790cd0-b8de-4bbc-98a5-25f79587ba0d</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,9f790cd0-b8de-4bbc-98a5-25f79587ba0d.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,9f790cd0-b8de-4bbc-98a5-25f79587ba0d.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9f790cd0-b8de-4bbc-98a5-25f79587ba0d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Just wanted to call out attention to a new Silverlight site created by Maine’s own
Carolyn Smith: <a href="http://www.silverlightmadam.com">www.silverlightmadam.com</a></p>
        <p>
          <em>“Silverlight Madam is the creation of Carolyn Smith. For many years Carolyn's
preferred medium was watercolors. Then she discovered computer graphics and now she
specializes in creating art in Silverlight.”</em>
        </p>
        <p>
Note: Carolyn also runs the site <a href="http://www.pixycolors.com">www.pixycolors.com</a>.
</p>
      </body>
      <title>Madam Silverlight</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,9f790cd0-b8de-4bbc-98a5-25f79587ba0d.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/06/09/MadamSilverlight.aspx</link>
      <pubDate>Thu, 09 Jun 2011 12:00:26 GMT</pubDate>
      <description>&lt;p&gt;
Just wanted to call out attention to a new Silverlight site created by Maine’s own
Carolyn Smith: &lt;a href="http://www.silverlightmadam.com"&gt;www.silverlightmadam.com&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;“Silverlight Madam is the creation of Carolyn Smith. For many years Carolyn's
preferred medium was watercolors. Then she discovered computer graphics and now she
specializes in creating art in Silverlight.”&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
Note: Carolyn also runs the site &lt;a href="http://www.pixycolors.com"&gt;www.pixycolors.com&lt;/a&gt;.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,9f790cd0-b8de-4bbc-98a5-25f79587ba0d.aspx</comments>
      <category>Silverlight</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=fc1a7941-2529-4b23-99a7-78ad340c0cce</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,fc1a7941-2529-4b23-99a7-78ad340c0cce.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,fc1a7941-2529-4b23-99a7-78ad340c0cce.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=fc1a7941-2529-4b23-99a7-78ad340c0cce</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just had Skype crashing on me every time it tried to connect and go online. The
following worked for me (on Windows 7):
</p>
        <p>
1. If the Skype icon is displayed in the system tray at the bottom right of the screen,
right-click it and select Quit. 
<br />
2. Click Start, type "run" and press Enter. (On Windows XP: Click Start
and then Run.) 
<br />
3. Type "%appdata%\skype" and click OK. 
<br />
4. Locate and delete the file shared.xml. The file may be displayed as shared if file
extensions are not displayed by default on your computer. 
<br />
5.If you cannot find this file: 
<br />
-&gt; Click Start, type "run" and press Enter. (On Windows XP: Click Start
and then Run.) 
<br />
-&gt; Type "control folders" and click OK. 
<br />
-&gt; In the View tab, ensure that Show hidden files and folders is enabled. 
<br />
-&gt; Repeat the instructions from the beginning. 
<br />
6. Restart Skype. 
<br />
7. Choose ‘Check for Updates’ from the ‘Help’ menu. Perform upgrade to the latest
version.
</p>
      </body>
      <title>Fixing Skype [Windows]</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,fc1a7941-2529-4b23-99a7-78ad340c0cce.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/06/07/FixingSkypeWindows.aspx</link>
      <pubDate>Tue, 07 Jun 2011 12:59:49 GMT</pubDate>
      <description>&lt;p&gt;
I just had Skype crashing on me every time it tried to connect and go online. The
following worked for me (on Windows 7):
&lt;/p&gt;
&lt;p&gt;
1. If the Skype icon is displayed in the system tray at the bottom right of the screen,
right-click it and select Quit. 
&lt;br /&gt;
2. Click Start, type &amp;quot;run&amp;quot; and press Enter. (On Windows XP: Click Start
and then Run.) 
&lt;br /&gt;
3. Type &amp;quot;%appdata%\skype&amp;quot; and click OK. 
&lt;br /&gt;
4. Locate and delete the file shared.xml. The file may be displayed as shared if file
extensions are not displayed by default on your computer. 
&lt;br /&gt;
5.If you cannot find this file: 
&lt;br /&gt;
-&amp;gt; Click Start, type &amp;quot;run&amp;quot; and press Enter. (On Windows XP: Click Start
and then Run.) 
&lt;br /&gt;
-&amp;gt; Type &amp;quot;control folders&amp;quot; and click OK. 
&lt;br /&gt;
-&amp;gt; In the View tab, ensure that Show hidden files and folders is enabled. 
&lt;br /&gt;
-&amp;gt; Repeat the instructions from the beginning. 
&lt;br /&gt;
6. Restart Skype. 
&lt;br /&gt;
7. Choose ‘Check for Updates’ from the ‘Help’ menu. Perform upgrade to the latest
version.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,fc1a7941-2529-4b23-99a7-78ad340c0cce.aspx</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=8cd340da-9b8b-4778-a680-62f941428ef4</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,8cd340da-9b8b-4778-a680-62f941428ef4.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,8cd340da-9b8b-4778-a680-62f941428ef4.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8cd340da-9b8b-4778-a680-62f941428ef4</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Gartner is mentioning Bangladesh as a country that is growing when it comes as a place
for outsourcing IT. <a href="http://www.omnext.net" target="_blank">Omnext</a> was
part of a Dutch trade delegation that went down to Bangladesh to explore opportunities.
This <a href="http://www.computable.nl/artikel/ict_topics/outsourcing/3919868/1276946/bedrijfsleven-bekijkt-outsourcing-in-bangladesh.html?utm_source=Nieuwsbrief&amp;utm_medium=E-mail&amp;utm_campaign=Redactiemailing" target="_blank">article</a> (in
Dutch) has the details. Omnext delivers software and services to create an MRI-scan
of your software. This can be used in outsourcing projects to measure progress, quality
and complexity.
</p>
      </body>
      <title>IT Outsourcing to Bangladesh</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,8cd340da-9b8b-4778-a680-62f941428ef4.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/05/05/ITOutsourcingToBangladesh.aspx</link>
      <pubDate>Thu, 05 May 2011 12:39:04 GMT</pubDate>
      <description>&lt;p&gt;
Gartner is mentioning Bangladesh as a country that is growing when it comes as a place
for outsourcing IT. &lt;a href="http://www.omnext.net" target="_blank"&gt;Omnext&lt;/a&gt; was
part of a Dutch trade delegation that went down to Bangladesh to explore opportunities.
This &lt;a href="http://www.computable.nl/artikel/ict_topics/outsourcing/3919868/1276946/bedrijfsleven-bekijkt-outsourcing-in-bangladesh.html?utm_source=Nieuwsbrief&amp;amp;utm_medium=E-mail&amp;amp;utm_campaign=Redactiemailing" target="_blank"&gt;article&lt;/a&gt; (in
Dutch) has the details. Omnext delivers software and services to create an MRI-scan
of your software. This can be used in outsourcing projects to measure progress, quality
and complexity.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,8cd340da-9b8b-4778-a680-62f941428ef4.aspx</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=981a649f-5ab4-4011-9599-28edb3babe5e</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,981a649f-5ab4-4011-9599-28edb3babe5e.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,981a649f-5ab4-4011-9599-28edb3babe5e.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=981a649f-5ab4-4011-9599-28edb3babe5e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
On May 16th the Maine Developer Network will be hosting the Augusta Business Intelligence
Event and you're invited to attend. 
<br /><br />
Thanks goes to John Gagnon for putting together a great event! Here is the tentative
agenda for the day: 
<br /><br />
8:30am - 9:00am Registration (and Breakfast if we find a sponsor)   
<br />
9:00 am - 10:00 am Designing the Business Process Dimensional Model   
<br />
10:10 am - 11:30 am ETL System Physical Design - 
<br />
11:40 am - 12:40 am Lunch 
<br />
12:40 pm - 2:00pm Designing the Analysis Services OLAP Database - Slava Kokaev 
<br />
2:10 pm - 3:20pm  Interactive Dashboards with PerformancePoint 2010 - Sunil Kadimdiwan 
<br />
3:30 pm - 4:30pm Custom BI Applications and Interactive Dashboards -  Slava Kokaev
</p>
        <p>
          <br />
          <em>Presenters:</em>
          <br />
          <b>Slava Kokaev</b> - Principal BI Developer/Architect at Industrial Defender, specializing
in Design and Development of Business Intelligence Systems, Custom BI Web Applications
and BI Integration. Slava is a Boston Microsoft Business Intelligence User Group leader,
SQL Server Community and INETA Regional speaker. 
<br /><br /><b>Sunil Kadimdiwan</b> - has 25+ years' experience in architecting and implementing
database solutions. He has deep knowledge of the Microsoft SQL Server and Business
Intelligence technology stack. He is a frequent speaker at Microsoft sponsored code
camps and user group meetings in the New England region. 
<br /><br />
The event will be held at: 
<br />
Central Main Commerce Center 
<br />
Florian Auditorium 
<br />
45 Commerce Drive 
<br />
Augusta, ME 
<br /><br />
Go to <a href="http://www.maine-devnet.org/Home/SignUpForEvent.aspx">www.maine-devnet.org/Home/SignUpForEvent.aspx</a> to
sign up and find for more information.
</p>
      </body>
      <title>Augusta Business Intelligence Event, May 16th, 2011</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,981a649f-5ab4-4011-9599-28edb3babe5e.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/05/02/AugustaBusinessIntelligenceEventMay16th2011.aspx</link>
      <pubDate>Mon, 02 May 2011 12:52:29 GMT</pubDate>
      <description>&lt;p&gt;
On May 16th the Maine Developer Network will be hosting the Augusta Business Intelligence
Event and you're invited to attend. 
&lt;br /&gt;
&lt;br /&gt;
Thanks goes to John Gagnon for putting together a great event! Here is the tentative
agenda for the day: 
&lt;br /&gt;
&lt;br /&gt;
8:30am - 9:00am Registration (and Breakfast if we find a sponsor)&amp;#160;&amp;#160; 
&lt;br /&gt;
9:00 am - 10:00 am Designing the Business Process Dimensional Model&amp;#160;&amp;#160; 
&lt;br /&gt;
10:10 am - 11:30 am ETL System Physical Design - 
&lt;br /&gt;
11:40 am - 12:40 am Lunch 
&lt;br /&gt;
12:40 pm - 2:00pm Designing the Analysis Services OLAP Database - Slava Kokaev 
&lt;br /&gt;
2:10 pm - 3:20pm&amp;#160; Interactive Dashboards with PerformancePoint 2010 - Sunil Kadimdiwan 
&lt;br /&gt;
3:30 pm - 4:30pm Custom BI Applications and Interactive Dashboards -&amp;#160; Slava Kokaev
&lt;/p&gt;
&lt;p&gt;
&lt;br /&gt;
&lt;em&gt;Presenters:&lt;/em&gt; 
&lt;br /&gt;
&lt;b&gt;Slava Kokaev&lt;/b&gt; - Principal BI Developer/Architect at Industrial Defender, specializing
in Design and Development of Business Intelligence Systems, Custom BI Web Applications
and BI Integration. Slava is a Boston Microsoft Business Intelligence User Group leader,
SQL Server Community and INETA Regional speaker. 
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sunil Kadimdiwan&lt;/b&gt; - has 25+ years' experience in architecting and implementing
database solutions. He has deep knowledge of the Microsoft SQL Server and Business
Intelligence technology stack. He is a frequent speaker at Microsoft sponsored code
camps and user group meetings in the New England region. 
&lt;br /&gt;
&lt;br /&gt;
The event will be held at: 
&lt;br /&gt;
Central Main Commerce Center 
&lt;br /&gt;
Florian Auditorium 
&lt;br /&gt;
45 Commerce Drive 
&lt;br /&gt;
Augusta, ME 
&lt;br /&gt;
&lt;br /&gt;
Go to &lt;a href="http://www.maine-devnet.org/Home/SignUpForEvent.aspx"&gt;www.maine-devnet.org/Home/SignUpForEvent.aspx&lt;/a&gt; to
sign up and find for more information.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,981a649f-5ab4-4011-9599-28edb3babe5e.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=5664e751-a107-427d-8d95-9c973464c3ae</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,5664e751-a107-427d-8d95-9c973464c3ae.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,5664e751-a107-427d-8d95-9c973464c3ae.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5664e751-a107-427d-8d95-9c973464c3ae</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I had a little bit of challenge trying to demonstrate the behavior of TaskSchedular.UnobservedTaskException.
TaskSchedular.UnobservedTaskException can be used to deal with any unhandled exception
that occurs during the execution of a task. The event fires when the garbage collector
tries to clean up the task. My initial code was good, but I forgot to wait for the
task to be done before forcing the GC to do its job <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/0ebbd643e812_DE53/wlEmoticon-smile_2.png" /></p>
        <p>
The code below is an effective example of how TaskSchedular.UnobservedTaskException
works. 
</p>
        <!-- Start block. Created with Code4Blog for Microsoft Visual Studio 2010. Copyright (c)2010 Vitaly Zayko http://zayko.net -->
        <div style="border-bottom: black 1px solid; border-left: black 1px solid; padding-bottom: 5px; padding-left: 5px; width: 99.5%; padding-right: 5px; color: black; overflow: auto; border-top: black 1px solid; border-right: black 1px solid; padding-top: 5px">
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">1:</span>
            <span style="color: #0000ff">public</span>
            <span style="color: #000000">
              <span style="color: #0000ff">class</span>
              <span style="color: #000000">
                <span style="color: #2b91af">Example</span>
                <span style="color: #000000">
                </span>
              </span>
            </span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">2:</span>
            <span style="color: #000000">{</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">3:</span>
            <span style="color: #0000ff">public</span>
            <span style="color: #000000">
              <span style="color: #0000ff">void</span>
              <span style="color: #000000"> Test()
</span>
            </span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">4:</span>
            <span style="color: #000000">{</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">5:</span>
            <span style="color: #2b91af">Task</span>
            <span style="color: #000000"> t
= <span style="color: #0000ff">new</span><span style="color: #000000"><span style="color: #2b91af">Task</span><span style="color: #000000"> ( <span style="color: #0000ff">delegate</span><span style="color: #000000"></span></span></span></span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">6:</span>
            <span style="color: #000000">{</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">7:</span>
            <span style="color: #2b91af">Console</span>
            <span style="color: #000000"> .WriteLine( <span style="color: #ff0000">"Do
test, just before exception."</span><span style="color: #000000"> );
</span></span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">8:</span>
            <span style="color: #0000ff">throw</span>
            <span style="color: #000000">
              <span style="color: #0000ff">new</span>
              <span style="color: #000000">
                <span style="color: #2b91af">Exception</span>
                <span style="color: #000000"> ();
</span>
              </span>
            </span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">9:</span>
            <span style="color: #000000">}</span> );</pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">10:</span> t.Start();</pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">11:</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">12:</span>
            <span style="color: #000000">}</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">13:</span>
            <span style="color: #000000">}</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">14:</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">15:</span>
            <span style="color: #0000ff">class</span>
            <span style="color: #000000">
              <span style="color: #2b91af">Program</span>
              <span style="color: #000000">
              </span>
            </span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">16:</span>
            <span style="color: #000000">{</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">17:</span>
            <span style="color: #0000ff">static</span>
            <span style="color: #000000">
              <span style="color: #0000ff">void</span>
              <span style="color: #000000"> Main( <span style="color: #0000ff">string</span><span style="color: #000000"> []
args )
</span></span>
            </span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">18:</span>
            <span style="color: #000000">{</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">19:</span>
            <span style="color: #2b91af">TaskScheduler</span>
            <span style="color: #000000"> .UnobservedTaskException
+= <span style="color: #0000ff">new</span><span style="color: #000000"><span style="color: #2b91af">EventHandler</span><span style="color: #000000"> &lt;<span style="color: #2b91af">UnobservedTaskExceptionEventArgs</span><span style="color: #000000"> &gt;(
TaskScheduler_UnobservedTaskException );
</span></span></span></span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">20:</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">21:</span>
            <span style="color: #2b91af">Example</span>
            <span style="color: #000000"> example
= <span style="color: #0000ff">new</span><span style="color: #000000"><span style="color: #2b91af">Example</span><span style="color: #000000"> ();
</span></span></span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">22:</span> example.Test();</pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">23:</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">24:</span>
            <span style="color: #2b91af">Thread</span>
            <span style="color: #000000"> .Sleep(
2000 ); <span style="color: #008000">// delay is needed to make sure the task is done
before calling GC.</span><span style="color: #000000"></span></span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">25:</span>
            <span style="color: #2b91af">Console</span>
            <span style="color: #000000"> .WriteLine( <span style="color: #ff0000">"Done
sleeping"</span><span style="color: #000000"> );
</span></span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">26:</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">27:</span>
            <span style="color: #2b91af">GC</span>
            <span style="color: #000000"> .Collect();
</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">28:</span>
            <span style="color: #2b91af">GC</span>
            <span style="color: #000000"> .WaitForPendingFinalizers();
</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">29:</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">30:</span>
            <span style="color: #2b91af">Console</span>
            <span style="color: #000000"> .ReadLine();
</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">31:</span>
            <span style="color: #000000">}</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">32:</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">33:</span>
            <span style="color: #0000ff">static</span>
            <span style="color: #000000">
              <span style="color: #0000ff">void</span>
              <span style="color: #000000"> TaskScheduler_UnobservedTaskException( <span style="color: #0000ff">object</span><span style="color: #000000"> sender, <span style="color: #2b91af">UnobservedTaskExceptionEventArgs</span><span style="color: #000000"> e
)
</span></span></span>
            </span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">34:</span>
            <span style="color: #000000">{</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">35:</span>
            <span style="color: #2b91af">Console</span>
            <span style="color: #000000"> .WriteLine( <span style="color: #ff0000">"Error."</span><span style="color: #000000"> );
</span></span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">36:</span> e.SetObserved();</pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">37:</span>
            <span style="color: #000000">}</span>
          </pre>
          <pre style="margin: 0em">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">38:</span>
            <span style="color: #000000">}</span>
          </pre>
          <pre style="margin: 0em; background: silver">
            <span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px">39:</span>
          </pre>
        </div>
        <!-- End block -->
      </body>
      <title>Example of TaskSchedular.UnobservedTaskException in action</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,5664e751-a107-427d-8d95-9c973464c3ae.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/03/31/ExampleOfTaskSchedularUnobservedTaskExceptionInAction.aspx</link>
      <pubDate>Thu, 31 Mar 2011 19:55:52 GMT</pubDate>
      <description>&lt;p&gt;
Today I had a little bit of challenge trying to demonstrate the behavior of TaskSchedular.UnobservedTaskException.
TaskSchedular.UnobservedTaskException can be used to deal with any unhandled exception
that occurs during the execution of a task. The event fires when the garbage collector
tries to clean up the task. My initial code was good, but I forgot to wait for the
task to be done before forcing the GC to do its job &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/0ebbd643e812_DE53/wlEmoticon-smile_2.png" /&gt;
&lt;/p&gt;
&lt;p&gt;
The code below is an effective example of how TaskSchedular.UnobservedTaskException
works. 
&lt;/p&gt;
&lt;!-- Start block. Created with Code4Blog for Microsoft Visual Studio 2010. Copyright (c)2010 Vitaly Zayko http://zayko.net --&gt;
&lt;div style="border-bottom: black 1px solid; border-left: black 1px solid; padding-bottom: 5px; padding-left: 5px; width: 99.5%; padding-right: 5px; color: black; overflow: auto; border-top: black 1px solid; border-right: black 1px solid; padding-top: 5px"&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #2b91af"&gt;Example&lt;/span&gt;&lt;span style="color: #000000"&gt; 
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;2:&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; Test()
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;4:&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;5:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Task&lt;/span&gt;&lt;span style="color: #000000"&gt; t
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #2b91af"&gt;Task&lt;/span&gt;&lt;span style="color: #000000"&gt; ( &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt;&lt;span style="color: #000000"&gt; 
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;6:&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;7:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;&lt;span style="color: #000000"&gt; .WriteLine( &lt;span style="color: #ff0000"&gt;&amp;quot;Do
test, just before exception.&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt; );
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;8:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;&lt;span style="color: #000000"&gt; ();
&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;9:&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt; );&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;10:&lt;/span&gt; t.Start();&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;11:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;12:&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;13:&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;14:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;15:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #2b91af"&gt;Program&lt;/span&gt;&lt;span style="color: #000000"&gt; 
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;16:&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;17:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; Main( &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; []
args )
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;18:&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;19:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TaskScheduler&lt;/span&gt;&lt;span style="color: #000000"&gt; .UnobservedTaskException
+= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&lt;span style="color: #000000"&gt; &amp;lt;&lt;span style="color: #2b91af"&gt;UnobservedTaskExceptionEventArgs&lt;/span&gt;&lt;span style="color: #000000"&gt; &amp;gt;(
TaskScheduler_UnobservedTaskException );
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;20:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;21:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Example&lt;/span&gt;&lt;span style="color: #000000"&gt; example
= &lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #2b91af"&gt;Example&lt;/span&gt;&lt;span style="color: #000000"&gt; ();
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;22:&lt;/span&gt; example.Test();&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;23:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;24:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;&lt;span style="color: #000000"&gt; .Sleep(
2000 ); &lt;span style="color: #008000"&gt;// delay is needed to make sure the task is done
before calling GC.&lt;/span&gt;&lt;span style="color: #000000"&gt; 
&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;25:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;&lt;span style="color: #000000"&gt; .WriteLine( &lt;span style="color: #ff0000"&gt;&amp;quot;Done
sleeping&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt; );
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;26:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;27:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;GC&lt;/span&gt;&lt;span style="color: #000000"&gt; .Collect();
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;28:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;GC&lt;/span&gt;&lt;span style="color: #000000"&gt; .WaitForPendingFinalizers();
&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;29:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;30:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;&lt;span style="color: #000000"&gt; .ReadLine();
&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;31:&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;32:&lt;/span&gt; &lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;33:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; TaskScheduler_UnobservedTaskException( &lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; sender, &lt;span style="color: #2b91af"&gt;UnobservedTaskExceptionEventArgs&lt;/span&gt;&lt;span style="color: #000000"&gt; e
)
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;34:&lt;/span&gt; &lt;span style="color: #000000"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;35:&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;&lt;span style="color: #000000"&gt; .WriteLine( &lt;span style="color: #ff0000"&gt;&amp;quot;Error.&amp;quot;&lt;/span&gt;&lt;span style="color: #000000"&gt; );
&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;36:&lt;/span&gt; e.SetObserved();&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;37:&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;38:&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0em; background: silver"&gt;&lt;span style="text-align: right; width: 30px; display: inline-block; color: black; margin-right: 10px"&gt;39:&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;
&lt;!-- End block --&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,5664e751-a107-427d-8d95-9c973464c3ae.aspx</comments>
      <category>C#</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=9b3378c0-328b-42bd-ab67-9c32173a5e75</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,9b3378c0-328b-42bd-ab67-9c32173a5e75.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,9b3378c0-328b-42bd-ab67-9c32173a5e75.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9b3378c0-328b-42bd-ab67-9c32173a5e75</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ll be speaking at the <a href="http://www.bangordevelopers.com" target="_blank">Bangor
Developers</a> meeting next week (March 22nd) about code contracts. The session is
all about improving code reliability and predictability using .NET code contracts.
Additionally Mark will demonstrate that using a tool like code contracts static analysis
essentially helps you do a thorough code review of your own code. If there is time
he’ll also do a demo of the Visual Studio Productivity Power Tools. 
</p>
      </body>
      <title>Better code through code contracts</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,9b3378c0-328b-42bd-ab67-9c32173a5e75.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/03/17/BetterCodeThroughCodeContracts.aspx</link>
      <pubDate>Thu, 17 Mar 2011 10:53:56 GMT</pubDate>
      <description>&lt;p&gt;
I’ll be speaking at the &lt;a href="http://www.bangordevelopers.com" target="_blank"&gt;Bangor
Developers&lt;/a&gt; meeting next week (March 22nd) about code contracts. The session is
all about improving code reliability and predictability using .NET code contracts.
Additionally Mark will demonstrate that using a tool like code contracts static analysis
essentially helps you do a thorough code review of your own code. If there is time
he’ll also do a demo of the Visual Studio Productivity Power Tools. 
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,9b3378c0-328b-42bd-ab67-9c32173a5e75.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=7cd7ef8f-a33b-4bbc-9f50-10a33cd7a48a</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,7cd7ef8f-a33b-4bbc-9f50-10a33cd7a48a.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,7cd7ef8f-a33b-4bbc-9f50-10a33cd7a48a.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7cd7ef8f-a33b-4bbc-9f50-10a33cd7a48a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For you benefit and amusement: here is my experience with upgrading to Visual Studio
2010 Service Pack 1.
</p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_3.png" width="517" height="484" />
        </p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_6.png" width="517" height="484" />
        </p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_9.png" width="517" height="484" />
        </p>
        <p>
10 minutes later:
</p>
        <p>
          <a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_11.png">
            <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_thumb_3.png" width="517" height="484" />
          </a>
        </p>
        <p>
Another 25 minutes later:
</p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_14.png" width="517" height="484" />
        </p>
        <p>
NOTE: If you are working on a Word document while installing the Visual Studio Tools
for Office then be warned that the installer will automatically shutdown Word when
it reaches this step! I lost a bunch of changes because of this! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/wlEmoticon-sadsmile_2.png" /></p>
        <p>
          <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_17.png" width="517" height="484" />
        </p>
        <p>
Restart required:
</p>
        <p>
          <a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_19.png">
            <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_thumb_6.png" width="425" height="169" />
          </a>
        </p>
        <p>
Reboot complete… start Visual Studio 2010 and check the Help | Info screen:
</p>
        <p>
          <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_16.png" width="768" height="299" />
        </p>
        <p>
Life is good!
</p>
        <p>
I’ve checked my DevExpress add-in and also the Code Contracts add-in that I’ve got
installed and both seem to be working fine. Nice!
</p>
      </body>
      <title>Installing Visual Studio SP1</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,7cd7ef8f-a33b-4bbc-9f50-10a33cd7a48a.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/03/10/InstallingVisualStudioSP1.aspx</link>
      <pubDate>Thu, 10 Mar 2011 10:15:18 GMT</pubDate>
      <description>&lt;p&gt;
For you benefit and amusement: here is my experience with upgrading to Visual Studio
2010 Service Pack 1.
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_3.png" width="517" height="484" /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_6.png" width="517" height="484" /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_9.png" width="517" height="484" /&gt;
&lt;/p&gt;
&lt;p&gt;
10 minutes later:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_11.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_thumb_3.png" width="517" height="484" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Another 25 minutes later:
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_14.png" width="517" height="484" /&gt;
&lt;/p&gt;
&lt;p&gt;
NOTE: If you are working on a Word document while installing the Visual Studio Tools
for Office then be warned that the installer will automatically shutdown Word when
it reaches this step! I lost a bunch of changes because of this! &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/wlEmoticon-sadsmile_2.png" /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_17.png" width="517" height="484" /&gt;
&lt;/p&gt;
&lt;p&gt;
Restart required:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_19.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_thumb_6.png" width="425" height="169" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Reboot complete… start Visual Studio 2010 and check the Help | Info screen:
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/605383ef9d40_88B6/image_16.png" width="768" height="299" /&gt;
&lt;/p&gt;
&lt;p&gt;
Life is good!
&lt;/p&gt;
&lt;p&gt;
I’ve checked my DevExpress add-in and also the Code Contracts add-in that I’ve got
installed and both seem to be working fine. Nice!
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,7cd7ef8f-a33b-4bbc-9f50-10a33cd7a48a.aspx</comments>
      <category>Visual Studio 2010</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=85f2f748-63d7-49b9-8548-74cadb99059e</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,85f2f748-63d7-49b9-8548-74cadb99059e.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,85f2f748-63d7-49b9-8548-74cadb99059e.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=85f2f748-63d7-49b9-8548-74cadb99059e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Visual Studio 2010 Service Pack 1 and also Team Foundation Server Service Pack 1 are
now available! More information about enhancements offered in this release can be
found on <a href="http://blogs.msdn.com/b/somasegar/archive/2011/03/07/visual-studio-2010-enhancements.aspx" target="_blank">Somasegar’s
blog</a> and <a href="http://blogs.msdn.com/b/bharry/archive/2011/03/08/vs-tfs-2010-sp1-and-tfs-project-server-integration-feature-pack-have-released.aspx" target="_blank">Brian
Harry’s blog</a>.
</p>
        <p>
Change lists can be found here:
</p>
        <ul>
          <li>
            <a href="http://support.microsoft.com/kb/983509">VS 2010 SP1 Changes (includes Test
and Lab Manager)</a>
          </li>
          <li>
            <a href="http://support.microsoft.com/kb/2182621">TFS 2010 SP1 Changes</a>
          </li>
        </ul>
        <p>
Go to the MSDN download center for immediate <a href="http://msdn.microsoft.com/subscriptions/downloads/" target="_blank">downloading</a>.
</p>
      </body>
      <title>Visual Studio 2010 SP1 + Team Foundation Server SP1 available</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,85f2f748-63d7-49b9-8548-74cadb99059e.aspx</guid>
      <link>http://www.develop-one.net/blog/2011/03/09/VisualStudio2010SP1TeamFoundationServerSP1Available.aspx</link>
      <pubDate>Wed, 09 Mar 2011 05:37:05 GMT</pubDate>
      <description>&lt;p&gt;
Visual Studio 2010 Service Pack 1 and also Team Foundation Server Service Pack 1 are
now available! More information about enhancements offered in this release can be
found on &lt;a href="http://blogs.msdn.com/b/somasegar/archive/2011/03/07/visual-studio-2010-enhancements.aspx" target="_blank"&gt;Somasegar’s
blog&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/b/bharry/archive/2011/03/08/vs-tfs-2010-sp1-and-tfs-project-server-integration-feature-pack-have-released.aspx" target="_blank"&gt;Brian
Harry’s blog&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Change lists can be found here:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://support.microsoft.com/kb/983509"&gt;VS 2010 SP1 Changes (includes Test
and Lab Manager)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://support.microsoft.com/kb/2182621"&gt;TFS 2010 SP1 Changes&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Go to the MSDN download center for immediate &lt;a href="http://msdn.microsoft.com/subscriptions/downloads/" target="_blank"&gt;downloading&lt;/a&gt;.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,85f2f748-63d7-49b9-8548-74cadb99059e.aspx</comments>
      <category>Visual Studio 2010</category>
    </item>
  </channel>
</rss>
