<?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, 25 Feb 2013 14:36:05 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=6e3d6677-0b96-46c2-a078-f3abbe8d7808</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,6e3d6677-0b96-46c2-a078-f3abbe8d7808.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,6e3d6677-0b96-46c2-a078-f3abbe8d7808.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6e3d6677-0b96-46c2-a078-f3abbe8d7808</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
NuGet 2.2.1 was released on February 15, 2013. The VS Extension version number is
2.2.40116.9051. 
</p>
        <p>
This release/update fixes 5 bugs. Here is a link to the issues fixed: <a title="http://nuget.codeplex.com/workitem/list/advanced?keyword=&amp;status=Closed&amp;type=All&amp;priority=All&amp;release=NuGet%202.2.1&amp;assignedTo=All&amp;component=All&amp;sortField=LastUpdatedDate&amp;sortDirection=Descending&amp;page=0" href="http://nuget.codeplex.com/workitem/list/advanced?keyword=&amp;status=Closed&amp;type=All&amp;priority=All&amp;release=NuGet%202.2.1&amp;assignedTo=All&amp;component=All&amp;sortField=LastUpdatedDate&amp;sortDirection=Descending&amp;page=0">http://nuget.codeplex.com/workitem/list/advanced?keyword=&amp;status=Closed&amp;type=All&amp;priority=All&amp;release=NuGet%202.2.1&amp;assignedTo=All&amp;component=All&amp;sortField=LastUpdatedDate&amp;sortDirection=Descending&amp;page=0</a></p>
        <p>
It is sometimes hard to find release notes on these updates, so here is a <a href="http://docs.nuget.org/docs/release-notes/nuget-2.2.1" target="_blank">link</a>. 
</p>
        <p>
Link: <a title="http://docs.nuget.org/docs/release-notes/nuget-2.2.1" href="http://docs.nuget.org/docs/release-notes/nuget-2.2.1">http://docs.nuget.org/docs/release-notes/nuget-2.2.1</a></p>
      </body>
      <title>NuGet 2.2.1</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,6e3d6677-0b96-46c2-a078-f3abbe8d7808.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/02/25/NuGet221.aspx</link>
      <pubDate>Mon, 25 Feb 2013 14:36:05 GMT</pubDate>
      <description>&lt;p&gt;
NuGet 2.2.1 was released on February 15, 2013. The VS Extension version number is
2.2.40116.9051. 
&lt;/p&gt;
&lt;p&gt;
This release/update fixes 5 bugs. Here is a link to the issues fixed: &lt;a title="http://nuget.codeplex.com/workitem/list/advanced?keyword=&amp;amp;status=Closed&amp;amp;type=All&amp;amp;priority=All&amp;amp;release=NuGet%202.2.1&amp;amp;assignedTo=All&amp;amp;component=All&amp;amp;sortField=LastUpdatedDate&amp;amp;sortDirection=Descending&amp;amp;page=0" href="http://nuget.codeplex.com/workitem/list/advanced?keyword=&amp;amp;status=Closed&amp;amp;type=All&amp;amp;priority=All&amp;amp;release=NuGet%202.2.1&amp;amp;assignedTo=All&amp;amp;component=All&amp;amp;sortField=LastUpdatedDate&amp;amp;sortDirection=Descending&amp;amp;page=0"&gt;http://nuget.codeplex.com/workitem/list/advanced?keyword=&amp;amp;status=Closed&amp;amp;type=All&amp;amp;priority=All&amp;amp;release=NuGet%202.2.1&amp;amp;assignedTo=All&amp;amp;component=All&amp;amp;sortField=LastUpdatedDate&amp;amp;sortDirection=Descending&amp;amp;page=0&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
It is sometimes hard to find release notes on these updates, so here is a &lt;a href="http://docs.nuget.org/docs/release-notes/nuget-2.2.1" target="_blank"&gt;link&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Link: &lt;a title="http://docs.nuget.org/docs/release-notes/nuget-2.2.1" href="http://docs.nuget.org/docs/release-notes/nuget-2.2.1"&gt;http://docs.nuget.org/docs/release-notes/nuget-2.2.1&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,6e3d6677-0b96-46c2-a078-f3abbe8d7808.aspx</comments>
      <category>NuGet</category>
      <category>Visual Studio 2012</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=cd1d5e0f-b26e-4b12-b830-f77111aaa41c</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,cd1d5e0f-b26e-4b12-b830-f77111aaa41c.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,cd1d5e0f-b26e-4b12-b830-f77111aaa41c.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=cd1d5e0f-b26e-4b12-b830-f77111aaa41c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
A new update to Productivity Power Tools 2012! This update includes a couple of bug
fixes including a crashing bug in the Custom Document Tab Well on debug. Download
now!
</p>
        <p>
Link: <a title="http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd?SRC=VSIDE" href="http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd?SRC=VSIDE">http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd?SRC=VSIDE</a>  
<br />
Download: <a title="ProPowerTools.vsix" href="http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd/file/88404/2/ProPowerTools.vsix">ProPowerTools.vsix</a></p>
      </body>
      <title>Productivity Power Tools 2012 – February 2012</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,cd1d5e0f-b26e-4b12-b830-f77111aaa41c.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/02/25/ProductivityPowerTools2012February2012.aspx</link>
      <pubDate>Mon, 25 Feb 2013 14:29:42 GMT</pubDate>
      <description>&lt;p&gt;
A new update to Productivity Power Tools 2012! This update includes a couple of bug
fixes including a crashing bug in the Custom Document Tab Well on debug. Download
now!
&lt;/p&gt;
&lt;p&gt;
Link: &lt;a title="http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd?SRC=VSIDE" href="http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd?SRC=VSIDE"&gt;http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd?SRC=VSIDE&lt;/a&gt;&amp;#160; 
&lt;br /&gt;
Download: &lt;a title="ProPowerTools.vsix" href="http://visualstudiogallery.msdn.microsoft.com/3a96a4dc-ba9c-4589-92c5-640e07332afd/file/88404/2/ProPowerTools.vsix"&gt;ProPowerTools.vsix&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,cd1d5e0f-b26e-4b12-b830-f77111aaa41c.aspx</comments>
      <category>Visual Studio 2012</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=bf1fba7f-6157-4fd7-84c1-6fdcb2c20e02</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,bf1fba7f-6157-4fd7-84c1-6fdcb2c20e02.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,bf1fba7f-6157-4fd7-84c1-6fdcb2c20e02.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=bf1fba7f-6157-4fd7-84c1-6fdcb2c20e02</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Here are some events in which I’m involved or which are being organized by friends:
</p>
        <p>
February 25, Maine Developer Network (Augusta, Maine): Two topics in this meeting:
First What’s New in Entity Framework 5 and second Using NuGet and creating packages.
More on: <a title="http://www.maine-devnet.org/Home/Meetings.aspx" href="http://www.maine-devnet.org/Home/Meetings.aspx">http://www.maine-devnet.org/Home/Meetings.aspx</a></p>
        <p>
February 26, Bangor Area .NET Developer (Bangor, Maine): Two topics in this meeting.
First Windows Azure and second How to get free/cheap Microsoft software. More on: <a title="http://www.bangordevelopers.com/" href="http://www.bangordevelopers.com/">http://www.bangordevelopers.com/</a></p>
        <p>
March 18, <a title="Software Developer Network" href="http://www.sdn.nl" target="_blank">SDN</a> Event
(Zeist, The Netherlands): A bunch of topics ranging from Delphi for iOS to Windows
Azure to SOLID principles. More on: <a title="http://www.sdn.nl/SDN/SDNEvent/Events2013/SDNEventMaart2013/tabid/219/Default.aspx" href="http://www.sdn.nl/SDN/SDNEvent/Events2013/SDNEventMaart2013/tabid/219/Default.aspx">http://www.sdn.nl/SDN/SDNEvent/Events2013/SDNEventMaart2013/tabid/219/Default.aspx</a></p>
      </body>
      <title>Upcoming Events</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,bf1fba7f-6157-4fd7-84c1-6fdcb2c20e02.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/02/16/UpcomingEvents.aspx</link>
      <pubDate>Sat, 16 Feb 2013 13:55:41 GMT</pubDate>
      <description>&lt;p&gt;
Here are some events in which I’m involved or which are being organized by friends:
&lt;/p&gt;
&lt;p&gt;
February 25, Maine Developer Network (Augusta, Maine): Two topics in this meeting:
First What’s New in Entity Framework 5 and second Using NuGet and creating packages.
More on: &lt;a title="http://www.maine-devnet.org/Home/Meetings.aspx" href="http://www.maine-devnet.org/Home/Meetings.aspx"&gt;http://www.maine-devnet.org/Home/Meetings.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
February 26, Bangor Area .NET Developer (Bangor, Maine): Two topics in this meeting.
First Windows Azure and second How to get free/cheap Microsoft software. More on: &lt;a title="http://www.bangordevelopers.com/" href="http://www.bangordevelopers.com/"&gt;http://www.bangordevelopers.com/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
March 18, &lt;a title="Software Developer Network" href="http://www.sdn.nl" target="_blank"&gt;SDN&lt;/a&gt; Event
(Zeist, The Netherlands): A bunch of topics ranging from Delphi for iOS to Windows
Azure to SOLID principles. More on: &lt;a title="http://www.sdn.nl/SDN/SDNEvent/Events2013/SDNEventMaart2013/tabid/219/Default.aspx" href="http://www.sdn.nl/SDN/SDNEvent/Events2013/SDNEventMaart2013/tabid/219/Default.aspx"&gt;http://www.sdn.nl/SDN/SDNEvent/Events2013/SDNEventMaart2013/tabid/219/Default.aspx&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,bf1fba7f-6157-4fd7-84c1-6fdcb2c20e02.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=de47486a-3fab-45ee-91e5-094c0f1a278a</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,de47486a-3fab-45ee-91e5-094c0f1a278a.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,de47486a-3fab-45ee-91e5-094c0f1a278a.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=de47486a-3fab-45ee-91e5-094c0f1a278a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I ran into this today. We needed to delete a project from <a href="http://tfs.visualstudio.com/" target="_blank">Team
Foundation Service</a>, but there is no way to do this through the UI. Luckily Buck
Hodges wrote a <a href="http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx" target="_blank">post</a> on
this already. You need to use the command line TFSDestroyProject.exe tool and make
sure to use the VS2012 version, not the VS2010. Also include ‘DefaultCollection’ when
specifying the collection name.
</p>
        <p>
Read more here: <a title="http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx" href="http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx">http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx</a></p>
      </body>
      <title>Deleting a project from Team Foundation Service</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,de47486a-3fab-45ee-91e5-094c0f1a278a.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/02/12/DeletingAProjectFromTeamFoundationService.aspx</link>
      <pubDate>Tue, 12 Feb 2013 16:06:30 GMT</pubDate>
      <description>&lt;p&gt;
I ran into this today. We needed to delete a project from &lt;a href="http://tfs.visualstudio.com/" target="_blank"&gt;Team
Foundation Service&lt;/a&gt;, but there is no way to do this through the UI. Luckily Buck
Hodges wrote a &lt;a href="http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx" target="_blank"&gt;post&lt;/a&gt; on
this already. You need to use the command line TFSDestroyProject.exe tool and make
sure to use the VS2012 version, not the VS2010. Also include ‘DefaultCollection’ when
specifying the collection name.
&lt;/p&gt;
&lt;p&gt;
Read more here: &lt;a title="http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx" href="http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx"&gt;http://blogs.msdn.com/b/buckh/archive/2011/09/19/how-to-delete-a-team-project-from-tfs-on-azure.aspx&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,de47486a-3fab-45ee-91e5-094c0f1a278a.aspx</comments>
      <category>Team Foundation Server</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=28c44cd8-ba5f-45bf-98d3-7b8435de6874</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,28c44cd8-ba5f-45bf-98d3-7b8435de6874.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,28c44cd8-ba5f-45bf-98d3-7b8435de6874.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=28c44cd8-ba5f-45bf-98d3-7b8435de6874</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is a little command line tool that can create the standard ASP.NET membership
and authentication tables in an existing SQL Server database instance. (Since I seem
to have a hard time remembering the name of the tool I’d figure I’d write a little
blurp on my blog to act as a reminder <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/979c39d56775_811F/wlEmoticon-smile_2.png" /> ).
</p>
        <p>
Aspnet_regsql.exe is a command line tool. You can run it without parameters to have
it help you in via wizard mode, or apply the right parameters and do it commando-style.
See <a title="http://msdn.microsoft.com/en-us/library/ms229862.aspx" href="http://msdn.microsoft.com/en-us/library/ms229862.aspx">http://msdn.microsoft.com/en-us/library/ms229862.aspx</a> for
available parameters.
</p>
        <p>
And if you want to enable the ASP.NET Web Administration Tool on a test or production
server, then this forum post <a title="http://forums.asp.net/t/932674.aspx/1" href="http://forums.asp.net/t/932674.aspx/1">http://forums.asp.net/t/932674.aspx/1</a> tells
you how to do that.
</p>
      </body>
      <title>Creating ASP.NET membership and authentication tables in SQL Server (Aspnet_regsql.exe)</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,28c44cd8-ba5f-45bf-98d3-7b8435de6874.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/01/29/CreatingASPNETMembershipAndAuthenticationTablesInSQLServerAspnetregsqlexe.aspx</link>
      <pubDate>Tue, 29 Jan 2013 15:13:32 GMT</pubDate>
      <description>&lt;p&gt;
There is a little command line tool that can create the standard ASP.NET membership
and authentication tables in an existing SQL Server database instance. (Since I seem
to have a hard time remembering the name of the tool I’d figure I’d write a little
blurp on my blog to act as a reminder &lt;img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Smile" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/979c39d56775_811F/wlEmoticon-smile_2.png" /&gt; ).
&lt;/p&gt;
&lt;p&gt;
Aspnet_regsql.exe is a command line tool. You can run it without parameters to have
it help you in via wizard mode, or apply the right parameters and do it commando-style.
See &lt;a title="http://msdn.microsoft.com/en-us/library/ms229862.aspx" href="http://msdn.microsoft.com/en-us/library/ms229862.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms229862.aspx&lt;/a&gt; for
available parameters.
&lt;/p&gt;
&lt;p&gt;
And if you want to enable the ASP.NET Web Administration Tool on a test or production
server, then this forum post &lt;a title="http://forums.asp.net/t/932674.aspx/1" href="http://forums.asp.net/t/932674.aspx/1"&gt;http://forums.asp.net/t/932674.aspx/1&lt;/a&gt; tells
you how to do that.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,28c44cd8-ba5f-45bf-98d3-7b8435de6874.aspx</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=7852dfe3-c18d-4c09-9ef4-dcb2723d4e91</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,7852dfe3-c18d-4c09-9ef4-dcb2723d4e91.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,7852dfe3-c18d-4c09-9ef4-dcb2723d4e91.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7852dfe3-c18d-4c09-9ef4-dcb2723d4e91</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The invitations just went out: I’ll be presenting at Augusta Tech Talk on February
25th 2013. There will be 2 sessions; one about NuGet and one about Entity Framework
5.
</p>
        <p>
For more information and registration got to: <a title="http://maine-devnet.org/Home/Meetings.aspx" href="http://maine-devnet.org/Home/Meetings.aspx">http://maine-devnet.org/Home/Meetings.aspx</a></p>
      </body>
      <title>Speaking at Augusta Tech Talk</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,7852dfe3-c18d-4c09-9ef4-dcb2723d4e91.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/01/24/SpeakingAtAugustaTechTalk.aspx</link>
      <pubDate>Thu, 24 Jan 2013 02:05:29 GMT</pubDate>
      <description>&lt;p&gt;
The invitations just went out: I’ll be presenting at Augusta Tech Talk on February
25th 2013. There will be 2 sessions; one about NuGet and one about Entity Framework
5.
&lt;/p&gt;
&lt;p&gt;
For more information and registration got to: &lt;a title="http://maine-devnet.org/Home/Meetings.aspx" href="http://maine-devnet.org/Home/Meetings.aspx"&gt;http://maine-devnet.org/Home/Meetings.aspx&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,7852dfe3-c18d-4c09-9ef4-dcb2723d4e91.aspx</comments>
      <category>Community</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=991364da-5e54-437e-b5e3-98d8c6eefefd</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,991364da-5e54-437e-b5e3-98d8c6eefefd.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,991364da-5e54-437e-b5e3-98d8c6eefefd.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=991364da-5e54-437e-b5e3-98d8c6eefefd</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been using NuGet for years, but recently I’ve been playing with around with NuGet
to try and explore some of the lesser known features. I’ve just been using NuGet to
effortlessly download and add assemblies to my projects, but where do these files
go? And how do I make sure that when I zip my sources and send them to another developer,
that person also has everything he needs? How does NuGet play with regards to source
control?
</p>
        <h2>Default NuGet Workflow
</h2>
        <p>
The default process when using NuGet to install a library (for example EntityFramework)
in your project is as follows:
</p>
        <ol>
          <li>
Start a new project in a new solution and add the solution to source control. 
</li>
          <li>
Open the Package Manager Console. 
</li>
          <li>
Type: “install-package EntityFramework” 
</li>
          <li>
At solution level NuGet creates a folder named ‘Packages’. 
</li>
          <li>
NuGet determines the most recently, non-beta, available version of EntityFramework
and downloads this file into a folder, named after your package in the ‘Packages’
folder. It also creates a ‘repositories.config’ file to keep track of which projects
are using NuGet. The folder may look something like this:  
<br /><br /><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/06771c973bdb_8F60/image_3.png" width="274" height="80" /><br /><br />
Note that all the files in the ‘Packages’ folder and it’s subfolders are automatically
added to source control. 
</li>
          <li>
NuGet adds a packages.config file to your project and uses this to keep track of which
packages and versions are installed in the project: 
<br /><br /><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/06771c973bdb_8F60/image_6.png" width="671" height="122" /><br /></li>
          <li>
When you now check into source control all configuration information as well as all
the downloaded packages are preserved and managed in source control.</li>
        </ol>
        <p>
The default approach works well in most scenarios, but has one downside: if you have
a lot packages in your solution, then the size of your source control branch may become
larger than desired. This would be less of an issue with say Team Foundation Server,
but more of an issue with a DVCS like Mercurial or Git.
</p>
        <h2>Restore During Build Workflow
</h2>
        <p>
An alternative approach is offered by using the Enabling Package Restore During Build
option. Read the <a href="http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages" target="_blank">tutorial
here</a> to see how it is done. 
<br />
There are three differences with the default NuGet workflow:
</p>
        <ol>
          <li>
A .nuget folder is added to the solution, which contains NuGet.exe, a config file
and a build file. These file will be added to source control upon check in.</li>
          <li>
Downloaded NuGet packages in the ‘Packages’ folder (they’re still there) are <u>not</u> added
to source control.</li>
          <li>
Every time you (re)build your project the NuGet build step will check to make sure
the appropriate NuGet packages have been downloaded.</li>
        </ol>
        <h2>Zipping projects
</h2>
        <p>
As a rule: whenever you want send someone the sources of a project that uses NuGet
for maintaining library references, make sure you send the solution, including the
packages folder. If you’re using the Restore During Build Workflow, then the zip does
not need to contain the actual packages.
</p>
      </body>
      <title>NuGet, Files and Source Control</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,991364da-5e54-437e-b5e3-98d8c6eefefd.aspx</guid>
      <link>http://www.develop-one.net/blog/2013/01/21/NuGetFilesAndSourceControl.aspx</link>
      <pubDate>Mon, 21 Jan 2013 15:33:33 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been using NuGet for years, but recently I’ve been playing with around with NuGet
to try and explore some of the lesser known features. I’ve just been using NuGet to
effortlessly download and add assemblies to my projects, but where do these files
go? And how do I make sure that when I zip my sources and send them to another developer,
that person also has everything he needs? How does NuGet play with regards to source
control?
&lt;/p&gt;
&lt;h2&gt;Default NuGet Workflow
&lt;/h2&gt;
&lt;p&gt;
The default process when using NuGet to install a library (for example EntityFramework)
in your project is as follows:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Start a new project in a new solution and add the solution to source control. 
&lt;/li&gt;
&lt;li&gt;
Open the Package Manager Console. 
&lt;/li&gt;
&lt;li&gt;
Type: “install-package EntityFramework” 
&lt;/li&gt;
&lt;li&gt;
At solution level NuGet creates a folder named ‘Packages’. 
&lt;/li&gt;
&lt;li&gt;
NuGet determines the most recently, non-beta, available version of EntityFramework
and downloads this file into a folder, named after your package in the ‘Packages’
folder. It also creates a ‘repositories.config’ file to keep track of which projects
are using NuGet. The folder may look something like this:&amp;#160; 
&lt;br /&gt;
&lt;br /&gt;
&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/06771c973bdb_8F60/image_3.png" width="274" height="80" /&gt; 
&lt;br /&gt;
&lt;br /&gt;
Note that all the files in the ‘Packages’ folder and it’s subfolders are automatically
added to source control. 
&lt;/li&gt;
&lt;li&gt;
NuGet adds a packages.config file to your project and uses this to keep track of which
packages and versions are installed in the project: 
&lt;br /&gt;
&lt;br /&gt;
&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/06771c973bdb_8F60/image_6.png" width="671" height="122" /&gt; 
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;
When you now check into source control all configuration information as well as all
the downloaded packages are preserved and managed in source control.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The default approach works well in most scenarios, but has one downside: if you have
a lot packages in your solution, then the size of your source control branch may become
larger than desired. This would be less of an issue with say Team Foundation Server,
but more of an issue with a DVCS like Mercurial or Git.
&lt;/p&gt;
&lt;h2&gt;Restore During Build Workflow
&lt;/h2&gt;
&lt;p&gt;
An alternative approach is offered by using the Enabling Package Restore During Build
option. Read the &lt;a href="http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages" target="_blank"&gt;tutorial
here&lt;/a&gt; to see how it is done. 
&lt;br /&gt;
There are three differences with the default NuGet workflow:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
A .nuget folder is added to the solution, which contains NuGet.exe, a config file
and a build file. These file will be added to source control upon check in.&lt;/li&gt;
&lt;li&gt;
Downloaded NuGet packages in the ‘Packages’ folder (they’re still there) are &lt;u&gt;not&lt;/u&gt; added
to source control.&lt;/li&gt;
&lt;li&gt;
Every time you (re)build your project the NuGet build step will check to make sure
the appropriate NuGet packages have been downloaded.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Zipping projects
&lt;/h2&gt;
&lt;p&gt;
As a rule: whenever you want send someone the sources of a project that uses NuGet
for maintaining library references, make sure you send the solution, including the
packages folder. If you’re using the Restore During Build Workflow, then the zip does
not need to contain the actual packages.
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,991364da-5e54-437e-b5e3-98d8c6eefefd.aspx</comments>
      <category>NuGet</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=2a943091-3a72-4d14-935b-e6e1f3e97237</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,2a943091-3a72-4d14-935b-e6e1f3e97237.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,2a943091-3a72-4d14-935b-e6e1f3e97237.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2a943091-3a72-4d14-935b-e6e1f3e97237</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft has just made good on its promise of frequent updates to Visual Studio.
The first update for Visual Studio 2012 is now available for download.
</p>
        <p>
Somegar has done a nice blog describing the new features in this update: <a title="http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx" href="http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx">http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx</a></p>
        <p>
Or jump straight to the download at: <a title="http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update" href="http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update">http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update</a></p>
      </body>
      <title>Visual Studio 2012 Update 1 is available</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,2a943091-3a72-4d14-935b-e6e1f3e97237.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/11/27/VisualStudio2012Update1IsAvailable.aspx</link>
      <pubDate>Tue, 27 Nov 2012 06:20:06 GMT</pubDate>
      <description>&lt;p&gt;
Microsoft has just made good on its promise of frequent updates to Visual Studio.
The first update for Visual Studio 2012 is now available for download.
&lt;/p&gt;
&lt;p&gt;
Somegar has done a nice blog describing the new features in this update: &lt;a title="http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx" href="http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx"&gt;http://blogs.msdn.com/b/somasegar/archive/2012/11/26/visual-studio-2012-update-1-now-available.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Or jump straight to the download at: &lt;a title="http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update" href="http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update"&gt;http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,2a943091-3a72-4d14-935b-e6e1f3e97237.aspx</comments>
      <category>Visual Studio 2012</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=1841ac2a-d6cb-4d45-9c77-9124f76a07a2</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,1841ac2a-d6cb-4d45-9c77-9124f76a07a2.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,1841ac2a-d6cb-4d45-9c77-9124f76a07a2.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1841ac2a-d6cb-4d45-9c77-9124f76a07a2</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Entity Framework 5 now supports enumerations (when using Visual Studio 2012 and targeting
the .NET 4.5 framework).
</p>
        <p>
So let’s have a look. We’ll create a table called Planet with a name and a field to
indicate whether it is habitable.
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="kwrd">CREATE</span>
            <span class="kwrd">TABLE</span> [dbo].[Planets](</pre>
          <pre>    [Id] [<span class="kwrd">int</span>] <span class="kwrd">IDENTITY</span>(1,1) <span class="kwrd">NOT</span><span class="kwrd">NULL</span>,</pre>
          <pre class="alt">    [Name] [nvarchar](<span class="kwrd">max</span>) <span class="kwrd">NOT</span><span class="kwrd">NULL</span>,</pre>
          <pre>    [Habitable] [<span class="kwrd">smallint</span>] <span class="kwrd">NOT</span><span class="kwrd">NULL</span>,</pre>
          <pre class="alt">
            <span class="kwrd">CONSTRAINT</span> [PK_Planets] <span class="kwrd">PRIMARY</span><span class="kwrd">KEY</span><span class="kwrd">CLUSTERED</span></pre>
          <pre>(</pre>
          <pre class="alt">    [Id] <span class="kwrd">ASC</span></pre>
          <pre>)<span class="kwrd">WITH</span> (PAD_INDEX
= <span class="kwrd">OFF</span>, STATISTICS_NORECOMPUTE = <span class="kwrd">OFF</span>,
IGNORE_DUP_KEY = <span class="kwrd">OFF</span>, ALLOW_ROW_LOCKS = <span class="kwrd">ON</span>,
ALLOW_PAGE_LOCKS = <span class="kwrd">ON</span>) <span class="kwrd">ON</span> [<span class="kwrd">PRIMARY</span>]</pre>
          <pre class="alt">) <span class="kwrd">ON</span> [<span class="kwrd">PRIMARY</span>]</pre>
          <pre>END</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>
        <p>
Note: the data type for ‘Habitable’ is a smallint.
</p>
        <p>
Next we’ll generate an entity data model from the database. Nothing exciting, since
our database has just one table.
</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/Entity-Framework-5-and-enumerations_A55D/image_5.png" width="209" height="204" />
        </p>
        <p>
When we inspect the properties of the ‘Habitable’ property we see that, as expected,
it is mapped to an Int16 (short).
</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/Entity-Framework-5-and-enumerations_A55D/image_8.png" width="262" height="318" />
        </p>
        <p>
Instead of a short we want to map the field to the following enumeration (note that
having the enumeration be of type ‘short’ is significant, the type you select for
your enum needs to match the column type in the database):
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="kwrd">public</span>
            <span class="kwrd">enum</span> HabitableEnum
: <span class="kwrd">short</span></pre>
          <pre>{</pre>
          <pre class="alt">  Humanoids = 1,</pre>
          <pre>  Insects = 2,</pre>
          <pre class="alt">  Droids = 3,</pre>
          <pre>  None = 4,</pre>
          <pre class="alt">  All = 5</pre>
          <pre>}</pre>
        </div>
        <p>
In order to so, we need to update the model with information about the enum. This
is done in the Model Browser. 
</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/Entity-Framework-5-and-enumerations_A55D/image_14.png" width="286" height="323" />
        </p>
        <p>
Look for the “Enum Types” node and right click to add an Enum to the conceptual model.
</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/Entity-Framework-5-and-enumerations_A55D/image_13.png" width="484" height="579" />
        </p>
        <p>
We can have a locally defined enumeration (to be used in the T4 code generation) or
we can refer to the previously defined enumeration by checking the “Reference external
type” checkbox.
</p>
        <p>
After adding the enumeration to the model we can now go and update the “Habitable”
property in the conceptual model, the enumeration will now be displayed in the type
listbox.
</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/Entity-Framework-5-and-enumerations_A55D/image_17.png" width="268" height="299" />
        </p>
        <p>
If we now browse through the generated code (click the triangle next to the Edmx file
in your solution explorer) you’ll see that the generated class for “Planet” is now
using the enumeration.
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="kwrd">public</span>
            <span class="kwrd">partial</span>
            <span class="kwrd">class</span> Planet</pre>
          <pre>{</pre>
          <pre class="alt">
            <span class="kwrd">public</span>
            <span class="kwrd">int</span> Id
{ get; set; }</pre>
          <pre>
            <span class="kwrd">public</span>
            <span class="kwrd">string</span> Name
{ get; set; }</pre>
          <pre class="alt">
            <span class="kwrd">public</span> EF5Demo.Xyz.HabitableEnum
Habitable { get; set; }</pre>
          <pre>}</pre>
        </div>
Should you not see the change, then right click on &lt;yourmodelname&gt;.tt and choose
“Run Custom Tool” in order for the T4 template to regenerate the classes. 
<p>
We can now write some code to insert and query the database. Here is an example:
</p><div class="csharpcode"><pre class="alt"></pre><pre>var ctx = new StarWarsEntities();</pre><pre class="alt">Planet p1 = <span class="kwrd">new</span> Planet()
{ Name = <span class="str">"Tatooine"</span>, Habitable = HabitableEnum.Droids };</pre><pre>Planet p2 = <span class="kwrd">new</span> Planet()
{ Name = <span class="str">"Coruscant"</span>, Habitable = HabitableEnum.Humanoids
};</pre><pre class="alt"> </pre><pre>ctx.Planets.Add( p1 );</pre><pre class="alt">ctx.Planets.Add( p2 );</pre><pre> </pre><pre class="alt">ctx.SaveChanges();</pre><pre> </pre><pre class="alt">var query = from p <span class="kwrd">in</span> ctx.Planets</pre><pre><span class="kwrd">where</span> p.Habitable
== HabitableEnum.Humanoids</pre><pre class="alt">            select p;</pre><pre> </pre><pre class="alt"><span class="kwrd">foreach</span> (
var p <span class="kwrd">in</span> query )</pre><pre>{</pre><pre class="alt">  Console.WriteLine( p.Name + <span class="str">"
- "</span> + p.Habitable );</pre><pre>}</pre><pre class="alt"> </pre><pre>Console.ReadLine();</pre></div><p>
When we run it: 
<br /><br /><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/Entity-Framework-5-and-enumerations_A55D/image_20.png" width="681" height="346" /></p><p>
That’s all there’s to it. Using enumerations with Entity Framework 5.
</p><p>
But wait, would it not be nice if we could use byte based enumerations and assign
multiple values of the HabitableEnum to a planet?
</p><p>
Lets modify the enumeration to use the Flags attribute:
</p><div class="csharpcode"><pre class="alt">[Flags]</pre><pre><span class="kwrd">public</span><span class="kwrd">enum</span> HabitableEnum
: <span class="kwrd">byte</span></pre><pre class="alt">{</pre><pre>  Humanoids = 0x1,</pre><pre class="alt">  Insects = 0x2,</pre><pre>  Droids = 0x4,</pre><pre class="alt">  None = 0x8</pre><pre>}</pre></div><p>
We need to change the type of the ‘Habitable’ column in the database to a tinyint
and we need to modify the information in the conceptual schema to inform the entity
framework of our change in design:
</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/Entity-Framework-5-and-enumerations_A55D/image_23.png" width="484" height="579" /></p><p>
The screenshot shows that we need to change the underlying type as well as check the
“Set Flags attribute”.
</p><p>
We can now write code that assigns multiple values to the habitable field:
</p><div class="csharpcode"><pre class="alt"><span class="kwrd">using</span> ( var ctx
= <span class="kwrd">new</span> StarWarsEntities() )</pre><pre>{</pre><pre class="alt">HabitableEnum x = HabitableEnum.Humanoids;</pre><pre>x |= HabitableEnum.Insects;</pre><pre class="alt"> </pre><pre>Planet p1 = <span class="kwrd">new</span> Planet()
{ Name = <span class="str">"Tatooine"</span>, Habitable = HabitableEnum.Droids };</pre><pre class="alt">Planet p2 = <span class="kwrd">new</span> Planet()
{ Name = <span class="str">"Coruscant"</span>, Habitable = x };</pre><pre> </pre><pre class="alt">ctx.Planets.Add( p1 );</pre><pre>ctx.Planets.Add( p2 );</pre><pre class="alt"> </pre><pre>ctx.SaveChanges();</pre><pre class="alt"> </pre><pre>var query = from p <span class="kwrd">in</span> ctx.Planets</pre><pre class="alt">            select p;</pre><pre> </pre><pre class="alt"><span class="kwrd">foreach</span> (
var p <span class="kwrd">in</span> query )</pre><pre>{</pre><pre class="alt">  Console.WriteLine( p.Name + <span class="str">"
- "</span> + p.Habitable );</pre><pre>}</pre><pre class="alt"> </pre><pre>Console.ReadLine();</pre><pre class="alt">}</pre></div><p>
The output looks like this:
</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/Entity-Framework-5-and-enumerations_A55D/image_26.png" width="681" height="346" /></p><p>
If you wish to query for just insects you need to write a bitwise AND statement, like:
</p><div class="csharpcode"><pre class="alt">var query = from p <span class="kwrd">in</span> ctx.Planets</pre><pre><span class="kwrd">where</span> (
p.Habitable &amp; HabitableEnum.Insects ) == HabitableEnum.Insects</pre><pre class="alt">            select p;</pre></div><p>
That’s all folks, have fun!
</p></body>
      <title>Entity Framework 5 + Enumerations =&gt; What’s not to love?</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,1841ac2a-d6cb-4d45-9c77-9124f76a07a2.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/09/02/EntityFramework5EnumerationsWhatsNotToLove.aspx</link>
      <pubDate>Sun, 02 Sep 2012 16:42:43 GMT</pubDate>
      <description>&lt;p&gt;
Entity Framework 5 now supports enumerations (when using Visual Studio 2012 and targeting
the .NET 4.5 framework).
&lt;/p&gt;
&lt;p&gt;
So let’s have a look. We’ll create a table called Planet with a name and a field to
indicate whether it is habitable.
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;CREATE&lt;/span&gt; &lt;span class="kwrd"&gt;TABLE&lt;/span&gt; [dbo].[Planets](&lt;/pre&gt;&lt;pre&gt;    [Id] [&lt;span class="kwrd"&gt;int&lt;/span&gt;] &lt;span class="kwrd"&gt;IDENTITY&lt;/span&gt;(1,1) &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;&lt;pre class="alt"&gt;    [Name] [nvarchar](&lt;span class="kwrd"&gt;max&lt;/span&gt;) &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;&lt;pre&gt;    [Habitable] [&lt;span class="kwrd"&gt;smallint&lt;/span&gt;] &lt;span class="kwrd"&gt;NOT&lt;/span&gt; &lt;span class="kwrd"&gt;NULL&lt;/span&gt;,&lt;/pre&gt;&lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;CONSTRAINT&lt;/span&gt; [PK_Planets] &lt;span class="kwrd"&gt;PRIMARY&lt;/span&gt; &lt;span class="kwrd"&gt;KEY&lt;/span&gt; &lt;span class="kwrd"&gt;CLUSTERED&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;(&lt;/pre&gt;&lt;pre class="alt"&gt;    [Id] &lt;span class="kwrd"&gt;ASC&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;)&lt;span class="kwrd"&gt;WITH&lt;/span&gt; (PAD_INDEX
= &lt;span class="kwrd"&gt;OFF&lt;/span&gt;, STATISTICS_NORECOMPUTE = &lt;span class="kwrd"&gt;OFF&lt;/span&gt;,
IGNORE_DUP_KEY = &lt;span class="kwrd"&gt;OFF&lt;/span&gt;, ALLOW_ROW_LOCKS = &lt;span class="kwrd"&gt;ON&lt;/span&gt;,
ALLOW_PAGE_LOCKS = &lt;span class="kwrd"&gt;ON&lt;/span&gt;) &lt;span class="kwrd"&gt;ON&lt;/span&gt; [&lt;span class="kwrd"&gt;PRIMARY&lt;/span&gt;]&lt;/pre&gt;&lt;pre class="alt"&gt;) &lt;span class="kwrd"&gt;ON&lt;/span&gt; [&lt;span class="kwrd"&gt;PRIMARY&lt;/span&gt;]&lt;/pre&gt;&lt;pre&gt;END&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;
&lt;p&gt;
Note: the data type for ‘Habitable’ is a smallint.
&lt;/p&gt;
&lt;p&gt;
Next we’ll generate an entity data model from the database. Nothing exciting, since
our database has just one table.
&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/Entity-Framework-5-and-enumerations_A55D/image_5.png" width="209" height="204"&gt;
&lt;/p&gt;
&lt;p&gt;
When we inspect the properties of the ‘Habitable’ property we see that, as expected,
it is mapped to an Int16 (short).
&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/Entity-Framework-5-and-enumerations_A55D/image_8.png" width="262" height="318"&gt;
&lt;/p&gt;
&lt;p&gt;
Instead of a short we want to map the field to the following enumeration (note that
having the enumeration be of type ‘short’ is significant, the type you select for
your enum needs to match the column type in the database):
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;enum&lt;/span&gt; HabitableEnum
: &lt;span class="kwrd"&gt;short&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;  Humanoids = 1,&lt;/pre&gt;&lt;pre&gt;  Insects = 2,&lt;/pre&gt;&lt;pre class="alt"&gt;  Droids = 3,&lt;/pre&gt;&lt;pre&gt;  None = 4,&lt;/pre&gt;&lt;pre class="alt"&gt;  All = 5&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
In order to so, we need to update the model with information about the enum. This
is done in the Model Browser. 
&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/Entity-Framework-5-and-enumerations_A55D/image_14.png" width="286" height="323"&gt;
&lt;/p&gt;
&lt;p&gt;
Look for the “Enum Types” node and right click to add an Enum to the conceptual model.
&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/Entity-Framework-5-and-enumerations_A55D/image_13.png" width="484" height="579"&gt;
&lt;/p&gt;
&lt;p&gt;
We can have a locally defined enumeration (to be used in the T4 code generation) or
we can refer to the previously defined enumeration by checking the “Reference external
type” checkbox.
&lt;/p&gt;
&lt;p&gt;
After adding the enumeration to the model we can now go and update the “Habitable”
property in the conceptual model, the enumeration will now be displayed in the type
listbox.
&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/Entity-Framework-5-and-enumerations_A55D/image_17.png" width="268" height="299"&gt;
&lt;/p&gt;
&lt;p&gt;
If we now browse through the generated code (click the triangle next to the Edmx file
in your solution explorer) you’ll see that the generated class for “Planet” is now
using the enumeration.
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Planet&lt;/pre&gt;&lt;pre&gt;{&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;    &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;span class="kwrd"&gt;public&lt;/span&gt; EF5Demo.Xyz.HabitableEnum
Habitable { get; set; }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
Should you not see the change, then right click on &amp;lt;yourmodelname&amp;gt;.tt and choose
“Run Custom Tool” in order for the T4 template to regenerate the classes. 
&lt;p&gt;
We can now write some code to insert and query the database. Here is an example:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;/pre&gt;&lt;pre&gt;var ctx = new StarWarsEntities();&lt;/pre&gt;&lt;pre class="alt"&gt;Planet p1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; Planet()
{ Name = &lt;span class="str"&gt;"Tatooine"&lt;/span&gt;, Habitable = HabitableEnum.Droids };&lt;/pre&gt;&lt;pre&gt;Planet p2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; Planet()
{ Name = &lt;span class="str"&gt;"Coruscant"&lt;/span&gt;, Habitable = HabitableEnum.Humanoids
};&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;ctx.Planets.Add( p1 );&lt;/pre&gt;&lt;pre class="alt"&gt;ctx.Planets.Add( p2 );&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;ctx.SaveChanges();&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;var query = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; ctx.Planets&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;where&lt;/span&gt; p.Habitable
== HabitableEnum.Humanoids&lt;/pre&gt;&lt;pre class="alt"&gt;            select p;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (
var p &lt;span class="kwrd"&gt;in&lt;/span&gt; query )&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;  Console.WriteLine( p.Name + &lt;span class="str"&gt;"
- "&lt;/span&gt; + p.Habitable );&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Console.ReadLine();&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
When we run it: 
&lt;br&gt;
&lt;br&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/Entity-Framework-5-and-enumerations_A55D/image_20.png" width="681" height="346"&gt;
&lt;/p&gt;
&lt;p&gt;
That’s all there’s to it. Using enumerations with Entity Framework 5.
&lt;/p&gt;
&lt;p&gt;
But wait, would it not be nice if we could use byte based enumerations and assign
multiple values of the HabitableEnum to a planet?
&lt;/p&gt;
&lt;p&gt;
Lets modify the enumeration to use the Flags attribute:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;[Flags]&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;enum&lt;/span&gt; HabitableEnum
: &lt;span class="kwrd"&gt;byte&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;  Humanoids = 0x1,&lt;/pre&gt;&lt;pre class="alt"&gt;  Insects = 0x2,&lt;/pre&gt;&lt;pre&gt;  Droids = 0x4,&lt;/pre&gt;&lt;pre class="alt"&gt;  None = 0x8&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
We need to change the type of the ‘Habitable’ column in the database to a tinyint
and we need to modify the information in the conceptual schema to inform the entity
framework of our change in design:
&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/Entity-Framework-5-and-enumerations_A55D/image_23.png" width="484" height="579"&gt;
&lt;/p&gt;
&lt;p&gt;
The screenshot shows that we need to change the underlying type as well as check the
“Set Flags attribute”.
&lt;/p&gt;
&lt;p&gt;
We can now write code that assigns multiple values to the habitable field:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; ( var ctx
= &lt;span class="kwrd"&gt;new&lt;/span&gt; StarWarsEntities() )&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;HabitableEnum x = HabitableEnum.Humanoids;&lt;/pre&gt;&lt;pre&gt;x |= HabitableEnum.Insects;&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Planet p1 = &lt;span class="kwrd"&gt;new&lt;/span&gt; Planet()
{ Name = &lt;span class="str"&gt;"Tatooine"&lt;/span&gt;, Habitable = HabitableEnum.Droids };&lt;/pre&gt;&lt;pre class="alt"&gt;Planet p2 = &lt;span class="kwrd"&gt;new&lt;/span&gt; Planet()
{ Name = &lt;span class="str"&gt;"Coruscant"&lt;/span&gt;, Habitable = x };&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;ctx.Planets.Add( p1 );&lt;/pre&gt;&lt;pre&gt;ctx.Planets.Add( p2 );&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;ctx.SaveChanges();&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;var query = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; ctx.Planets&lt;/pre&gt;&lt;pre class="alt"&gt;            select p;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;foreach&lt;/span&gt; (
var p &lt;span class="kwrd"&gt;in&lt;/span&gt; query )&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;  Console.WriteLine( p.Name + &lt;span class="str"&gt;"
- "&lt;/span&gt; + p.Habitable );&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Console.ReadLine();&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
The output looks like this:
&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/Entity-Framework-5-and-enumerations_A55D/image_26.png" width="681" height="346"&gt;
&lt;/p&gt;
&lt;p&gt;
If you wish to query for just insects you need to write a bitwise AND statement, like:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;var query = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; ctx.Planets&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;where&lt;/span&gt; (
p.Habitable &amp;amp; HabitableEnum.Insects ) == HabitableEnum.Insects&lt;/pre&gt;&lt;pre class="alt"&gt;            select p;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
That’s all folks, have fun!
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,1841ac2a-d6cb-4d45-9c77-9124f76a07a2.aspx</comments>
      <category>Entity Framework</category>
      <category>Visual Studio 2012</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=ff593d70-9f7b-49a5-ac0e-6e10302810a8</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,ff593d70-9f7b-49a5-ac0e-6e10302810a8.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,ff593d70-9f7b-49a5-ac0e-6e10302810a8.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ff593d70-9f7b-49a5-ac0e-6e10302810a8</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Entity Framework 5 is included in Visual Studio 2012, but is also available to users
of Visual Studio 2010 (as a NuGet package: <a title="http://nuget.org/packages/EntityFramework/" href="http://nuget.org/packages/EntityFramework/">http://nuget.org/packages/EntityFramework/</a> ).
</p>
        <p>
Note: Some Entity Framework 5 features are only available when writing an application
that targets .NET 4.5. This includes enum support, spatial data types, table-valued
functions and the performance improvements.
</p>
        <p>
Read more about what is new on the MSDN ADO.NET blog: <a title="http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx" href="http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx">http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx</a></p>
        <p>
Update [08-27-2012] : Julie Lerman has an excellent post describing the difference
between running EF5 in a .NET 4 versus a .NET 4.5 application, read more on: <a title="http://thedatafarm.com/blog/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/" href="http://thedatafarm.com/blog/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/">http://thedatafarm.com/blog/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/</a></p>
      </body>
      <title>Entity Framework 5 is available</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,ff593d70-9f7b-49a5-ac0e-6e10302810a8.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/08/26/EntityFramework5IsAvailable.aspx</link>
      <pubDate>Sun, 26 Aug 2012 12:14:27 GMT</pubDate>
      <description>&lt;p&gt;
Entity Framework 5 is included in Visual Studio 2012, but is also available to users
of Visual Studio 2010 (as a NuGet package: &lt;a title="http://nuget.org/packages/EntityFramework/" href="http://nuget.org/packages/EntityFramework/"&gt;http://nuget.org/packages/EntityFramework/&lt;/a&gt; ).
&lt;/p&gt;
&lt;p&gt;
Note: Some Entity Framework 5 features are only available when writing an application
that targets .NET 4.5. This includes enum support, spatial data types, table-valued
functions and the performance improvements.
&lt;/p&gt;
&lt;p&gt;
Read more about what is new on the MSDN ADO.NET blog: &lt;a title="http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx" href="http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx"&gt;http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Update [08-27-2012] : Julie Lerman has an excellent post describing the difference
between running EF5 in a .NET 4 versus a .NET 4.5 application, read more on: &lt;a title="http://thedatafarm.com/blog/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/" href="http://thedatafarm.com/blog/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/"&gt;http://thedatafarm.com/blog/data-access/when-entity-framework-5-ef5-is-not-entity-framework-5-ef5/&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,ff593d70-9f7b-49a5-ac0e-6e10302810a8.aspx</comments>
      <category>Entity Framework</category>
    </item>
    <item>
      <trackback:ping>http://www.develop-one.net/blog/Trackback.aspx?guid=5fe6bd8b-42cd-4733-a647-22c27e162389</trackback:ping>
      <pingback:server>http://www.develop-one.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.develop-one.net/blog/PermaLink,guid,5fe6bd8b-42cd-4733-a647-22c27e162389.aspx</pingback:target>
      <dc:creator>Mark Blomsma</dc:creator>
      <wfw:comment>http://www.develop-one.net/blog/CommentView,guid,5fe6bd8b-42cd-4733-a647-22c27e162389.aspx</wfw:comment>
      <wfw:commentRss>http://www.develop-one.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5fe6bd8b-42cd-4733-a647-22c27e162389</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For those of us with an MSDN subscription: Windows 8 RTM and Visual Studio 2012 are
both available for download. Go to <a title="https://msdn.microsoft.com/en-us/subscriptions" href="https://msdn.microsoft.com/en-us/subscriptions">https://msdn.microsoft.com/en-us/subscriptions</a> to
get your copy.
</p>
        <p>
 
</p>
        <p>
          <a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Windows-8-RTM-and-Visual-Studio-2012-now_9B7C/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/Windows-8-RTM-and-Visual-Studio-2012-now_9B7C/image_thumb.png" width="644" height="332" />
          </a>
        </p>
      </body>
      <title>Windows 8 RTM and Visual Studio 2012 now on MSDN</title>
      <guid isPermaLink="false">http://www.develop-one.net/blog/PermaLink,guid,5fe6bd8b-42cd-4733-a647-22c27e162389.aspx</guid>
      <link>http://www.develop-one.net/blog/2012/08/16/Windows8RTMAndVisualStudio2012NowOnMSDN.aspx</link>
      <pubDate>Thu, 16 Aug 2012 09:09:01 GMT</pubDate>
      <description>&lt;p&gt;
For those of us with an MSDN subscription: Windows 8 RTM and Visual Studio 2012 are
both available for download. Go to &lt;a title="https://msdn.microsoft.com/en-us/subscriptions" href="https://msdn.microsoft.com/en-us/subscriptions"&gt;https://msdn.microsoft.com/en-us/subscriptions&lt;/a&gt; to
get your copy.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.develop-one.net/blog/content/binary/Windows-Live-Writer/Windows-8-RTM-and-Visual-Studio-2012-now_9B7C/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/Windows-8-RTM-and-Visual-Studio-2012-now_9B7C/image_thumb.png" width="644" height="332" /&gt;&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://www.develop-one.net/blog/CommentView,guid,5fe6bd8b-42cd-4733-a647-22c27e162389.aspx</comments>
      <category>Visual Studio 2012</category>
      <category>Windows 8</category>
    </item>
    <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>
      <slash:comments>4</slash:comments>
      <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>
  </channel>
</rss>