<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scott&#039;s code and other ponderings... &#187; C#</title>
	<atom:link href="http://www.scottleckie.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scottleckie.com</link>
	<description>...how hard can it be?...</description>
	<lastBuildDate>Fri, 23 Dec 2011 01:55:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Acchhh&#8230; the type &#8216;System.Data.EntityState&#8217; is defined in an assembly that is not referenced&#8230;</title>
		<link>http://www.scottleckie.com/2011/05/acchhh-the-type-system-data-entitystate-is-defined-in-an-assembly-that-is-not-referenced/</link>
		<comments>http://www.scottleckie.com/2011/05/acchhh-the-type-system-data-entitystate-is-defined-in-an-assembly-that-is-not-referenced/#comments</comments>
		<pubDate>Sat, 28 May 2011 00:34:55 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Entity Framework]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=213</guid>
		<description><![CDATA[<p>This was a complete googlewhack; when&#160;I entered the complete text, I got exactly one response! BTW, when I try now I am up to three, so there are obviously at least two more people with the same challenges that I have&#8230;</p>
<p>&#160;</p>
<p>So, you look up the generic advice and they say a variation on the below;</p>

Update web.config to read &#34;&#60;add assembly=&#34;System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&#34; /&#62;&#34;

<p>All very exciting, but the key bit of information that we&#39;re missing is that adding the EntityFramework DLL / namespace does not complete the picture.</p>
<p>Make sure you add the .Net library &#34;System.Data.Entity&#34; and all will [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2011/05/acchhh-the-type-system-data-entitystate-is-defined-in-an-assembly-that-is-not-referenced/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RC of Entity Framework 4.1 (including EF Code First) is released</title>
		<link>http://www.scottleckie.com/2011/03/rc-of-entity-framework-4-1-including-ef-code-first-is-released/</link>
		<comments>http://www.scottleckie.com/2011/03/rc-of-entity-framework-4-1-including-ef-code-first-is-released/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 23:11:16 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=203</guid>
		<description><![CDATA[<p>Scott Guthrie announced on his blog that the Release Candidate of the excellent Entity Framework 4.1 is now available. See here for all the gen.</p>
<p>&#160;</p>
<p>He has also updated the &#34;NerdDinner&#34; sample project to use the new EF4.1 features, especially the &#34;Code First&#34; pattern where you can create lovely, clean POCO models and have them automatically create the database schema, update the schema and handle the repository actions.</p>
<p>It&#39;s a fantastic post and goes a long way to explaining the topics. However, given the bleeding-edge of this technology, there are a couple of differences between Scott&#39;s code and the RC code that you can get from here.</p>
New names for IDatabaseInitializer conventions
<p>Scott&#39;s code shows the following to persuade (in debug code) how to recreate [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2011/03/rc-of-entity-framework-4-1-including-ef-code-first-is-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ahhh&#8230; the olden days&#8230; DialogBox, MessagePumps and the joy of HWNDs</title>
		<link>http://www.scottleckie.com/2010/06/ahhh-the-olden-days-dialogbox-messagepumps-and-the-joy-of-hwnds/</link>
		<comments>http://www.scottleckie.com/2010/06/ahhh-the-olden-days-dialogbox-messagepumps-and-the-joy-of-hwnds/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 23:57:22 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Win32 API]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=127</guid>
		<description><![CDATA[<p>How soon we forget. A few years ago, I weaned myself off of Visual C++ and MFC and toyed (briefly) with ASP.NET</p>
<p>Now, I&#39;m finally getting to grips with C#, .NET and CLR 4.0 and Silverlight.</p>
<p>And, all of a sudden, I&#39;m thrust back to 1996. Why? Because we need to write a GINA (Graphical Identification aNd Authentication) component as part of a password reset application.</p>
<p>So, here we are, with definitely no CLR (which rules out C# and CLR) and recommended against the MFC. So, we&#39;re literally back in the days of defining dialog boxes as a set of resource definitions, and copious calls to CreateWindow. And that&#39;s before we get to the single threaded message pump that is WndProc.</p>
<p>Couple all of that [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2010/06/ahhh-the-olden-days-dialogbox-messagepumps-and-the-joy-of-hwnds/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>FileTreeView source (1.0.0.0)</title>
		<link>http://www.scottleckie.com/2010/04/filetreeview_source_1-0-0-0/</link>
		<comments>http://www.scottleckie.com/2010/04/filetreeview_source_1-0-0-0/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 00:01:24 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[FileTreeView]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=107</guid>
		<description><![CDATA[<p>I had promised to post this to codeproject, but I wanted that article to be sooooooooooooooooooooo perfect&#8230; I spent days and weeks and months and years writing the article but never got round to finishing it.</p>
<p>In the meantime, a number of people have asked for the source to FileTreeView and, as promised, here it is!</p>
<p>http://www.scottleckie.com/wp-content/uploads/FileTreeView.zip</p>
<p>&#160;</p>
<p>I&#39;m an open kinda guy so if you have any suggestions or improvements, please add a comment, or email me, and I&#39;ll do my best to incorporate [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2010/04/filetreeview_source_1-0-0-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Code 4004 &#8220;Unhandled error in silverlight application&#8221;</title>
		<link>http://www.scottleckie.com/2010/04/code-4004-unhandled-error-in-silverlight-application/</link>
		<comments>http://www.scottleckie.com/2010/04/code-4004-unhandled-error-in-silverlight-application/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 23:30:11 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=104</guid>
		<description><![CDATA[<p>Edit; 26th May 2010; This is my most favorite post! Check out related Silverlight posts here&#8230;</p>
<p>Just getting started in Silverlight 4 WCF RIA Services (which is astonishing, by the way &#8211; check out Brad Abram&#39;s walkthrough here) but I was getting stuck at the validation part.</p>
<p>When I exercise the validation (you know, red bits in the browser because you&#39;re failing metadata requirements) and SubmitChanges, it was throwing up a horrible error;</p>
<p style="margin-left: 40px">An unhandled exception (&#39;Unhandled Error in Silverlight Application</p>
<p style="margin-left: 40px">Code: 4004</p>
<p style="margin-left: 40px">Category: ManagedRunTimError</p>
<p style="margin-left: 40px">Message: System.ServiceModel.DomainServices.Client.DomainException: And error occurred while submitting changes&#8230;</p>
<p>The only funny bit about this was the typo; &#34;And error occurred&#34;&#8230; The dialog is shown here;</p>
<p></p>
<p>&#160;</p>
<p>OK &#8211; I got an exception, let&#39;s debug&#8230; So, I click [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2010/04/code-4004-unhandled-error-in-silverlight-application/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>&#8220;BindingExpression path error&#8221; when binding to a POCO</title>
		<link>http://www.scottleckie.com/2010/03/bindingexpression-path-error-when-binding-to-a-poco/</link>
		<comments>http://www.scottleckie.com/2010/03/bindingexpression-path-error-when-binding-to-a-poco/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 21:56:29 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=93</guid>
		<description><![CDATA[<p>I&#39;m passing a POCO to a Child Window, and the very first thing it needs to do is display a couple of properties from that object. So, I rattled off the basic code;</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;&#160;&#160;&#160;&#160;&#160;&#160; private MachineCredentials machineCreds { get; set; }</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;&#160;&#160;&#160;&#160;&#160;&#160; private BackupProviderType backupProvider { get; set; }</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;&#160;&#160;&#160;&#160;&#160;&#160; public RemoteBrowser(MachineCredentials machineCreds, BackupProviderType backupProvider)</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.machineCreds = machineCreds;</p>
<p class="MsoNormal" style="line-height: normal; margin: 0cm 0cm 0pt; mso-layout-grid-align: none">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.backupProvider = [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2010/03/bindingexpression-path-error-when-binding-to-a-poco/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My favourite log4net config settings</title>
		<link>http://www.scottleckie.com/2010/03/my-favourite-log4net-config-settings/</link>
		<comments>http://www.scottleckie.com/2010/03/my-favourite-log4net-config-settings/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 00:03:06 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=87</guid>
		<description><![CDATA[<p>It occurred to me, tonight, as I copied and pasted the same generic log4net config to a new project that I do this because this is my favourite log4net configuration. And, if it&#39;s a good enough starting point for all my projects then it may be of interest to others.</p>
<p>&#160;</p>
<p>This config writes to two appenders; the console and a file appender. The file appender is pretty neat in that it;</p>

Creates log files in a logs/ folder
The standard file is &#34;general.txt&#34;
This file grows on each iteration, until it reaches a maximum size of 2MB
When it hits 2MB, the file is renamed and a new &#34;general.txt&#34; file is opened
Maintains a maximum of 10 renamed / archived log files (so, a total of 20MB [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2010/03/my-favourite-log4net-config-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding log4net to a new project &#8211; cribsheet</title>
		<link>http://www.scottleckie.com/2010/03/adding-log4net-to-a-new-project-cribsheet/</link>
		<comments>http://www.scottleckie.com/2010/03/adding-log4net-to-a-new-project-cribsheet/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 00:13:13 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/?p=82</guid>
		<description><![CDATA[<p>log4net is a fantastic library for adding configurable logging to your project. Configuration is relatively straightforward but I always get caught out when adding it to a new project.</p>
<p>So, here&#39;s a cribsheet for adding it in&#8230;</p>

Download the latest stable library, and add a reference to it within your own project
Ensure that you have an app.config file
Add the configSection for log4net (see samples, below)
Add the log4net section (another sample)
Add an ILog object to your class
And, the bit I always forget, add the [assembly] entry to the top of your class

<p>In your app.config file, add log4net to the &#60;configSections&#62; (if you don&#39;t have one of these, it goes at the next level down from the &#60;configuration&#62; element;</p>
&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62;
&#60;configuration&#62;
&#60;configSections&#62;
&#60;section name=&#34;log4net&#34; type=&#34;log4net.Config.Log4NetConfigurationSectionHandler,log4net&#34; /&#62;
&#60;/configSections&#62;
<p>&#160;</p>
<p>Next, [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2010/03/adding-log4net-to-a-new-project-cribsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 3; Building a navigation tree from static and dynamic data</title>
		<link>http://www.scottleckie.com/2009/10/silverlight-3-building-a-navigation-tree-from-static-and-dynamic-data/</link>
		<comments>http://www.scottleckie.com/2009/10/silverlight-3-building-a-navigation-tree-from-static-and-dynamic-data/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 00:06:00 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/2009/10/silverlight-3-building-a-navigation-tree-from-static-and-dynamic-data/</guid>
		<description><![CDATA[The problem
<p>Build a navigation tree that allows users to navigate to specific static pages, from static entries in the menus, and to pages that are built dynamically based on selections from the menu.</p>

The Solution in a picture
<p> </p>
The solution in code
<p>Build the static menu selections in xaml, being sure to name each of the major headings with “Tag” entries;</p>

&#60;Grid x:Name=&#34;LayoutRoot&#34;&#62;

        &#60;controls:TreeView x:Name=&#34;treeview&#34;
                        BorderThickness=&#34;0&#34; 
                        Margin=&#34;0&#34; 
   [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2009/10/silverlight-3-building-a-navigation-tree-from-static-and-dynamic-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 3 – Binding POCO objects to XAML</title>
		<link>http://www.scottleckie.com/2009/10/silverlight-3-%e2%80%93-binding-poco-objects-to-xaml/</link>
		<comments>http://www.scottleckie.com/2009/10/silverlight-3-%e2%80%93-binding-poco-objects-to-xaml/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 23:45:00 +0000</pubDate>
		<dc:creator>Scott Leckie</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.scottleckie.com/2009/10/silverlight-3-%e2%80%93-binding-poco-objects-to-xaml/</guid>
		<description><![CDATA[<p>Obvious, really, but I spent ages chasing down how to bind some kind of POCO to a XAML display;</p>

  &#60;Grid x:Name=&#34;LayoutRoot&#34;&#62;

        &#60;Grid.RowDefinitions&#62;
            &#60;RowDefinition Height=&#34;300&#34; /&#62;
            &#60;RowDefinition Height=&#34;auto&#34; /&#62;
            &#60;RowDefinition Height=&#34;auto&#34; /&#62;
            &#60;RowDefinition Height=&#34;auto&#34;/&#62;
            &#60;RowDefinition Height=&#34;auto&#34;/&#62;
        &#60;/Grid.RowDefinitions&#62;
        &#60;Grid.ColumnDefinitions&#62;
        [...]]]></description>
		<wfw:commentRss>http://www.scottleckie.com/2009/10/silverlight-3-%e2%80%93-binding-poco-objects-to-xaml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

