Acchhh… the type ‘System.Data.EntityState’ is defined in an assembly that is not referenced…

This was a complete googlewhack; when 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…

 

So, you look up the generic advice and they say a variation on the below;

Update web.config to read "<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />"

All very exciting, but the key bit of information that we're missing is that adding the EntityFramework DLL / namespace does not complete the picture.

Make sure you add the .Net library "System.Data.Entity" and all will [...]

RC of Entity Framework 4.1 (including EF Code First) is released

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.

 

He has also updated the "NerdDinner" sample project to use the new EF4.1 features, especially the "Code First" 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.

It'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's code and the RC code that you can get from here.

New names for IDatabaseInitializer conventions

Scott's code shows the following to persuade (in debug code) how to recreate [...]

Ahhh... the olden days... DialogBox, MessagePumps and the joy of HWNDs

How soon we forget. A few years ago, I weaned myself off of Visual C++ and MFC and toyed (briefly) with ASP.NET

Now, I'm finally getting to grips with C#, .NET and CLR 4.0 and Silverlight.

And, all of a sudden, I'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.

So, here we are, with definitely no CLR (which rules out C# and CLR) and recommended against the MFC. So, we're literally back in the days of defining dialog boxes as a set of resource definitions, and copious calls to CreateWindow. And that's before we get to the single threaded message pump that is WndProc.

Couple all of that [...]

Complete Silverlight 4 training videos at channel9

Excellent Silverlight 4 training session [...]

FileTreeView source (1.0.0.0)

I had promised to post this to codeproject, but I wanted that article to be sooooooooooooooooooooo perfect… I spent days and weeks and months and years writing the article but never got round to finishing it.

In the meantime, a number of people have asked for the source to FileTreeView and, as promised, here it is!

http://www.scottleckie.com/wp-content/uploads/FileTreeView.zip

 

I'm an open kinda guy so if you have any suggestions or improvements, please add a comment, or email me, and I'll do my best to incorporate [...]

Code 4004

Edit; 26th May 2010; This is my most favorite post! Check out related Silverlight posts here…

Just getting started in Silverlight 4 WCF RIA Services (which is astonishing, by the way – check out Brad Abram's walkthrough here) but I was getting stuck at the validation part.

When I exercise the validation (you know, red bits in the browser because you're failing metadata requirements) and SubmitChanges, it was throwing up a horrible error;

An unhandled exception ('Unhandled Error in Silverlight Application

Code: 4004

Category: ManagedRunTimError

Message: System.ServiceModel.DomainServices.Client.DomainException: And error occurred while submitting changes…

The only funny bit about this was the typo; "And error occurred"… The dialog is shown here;

 

OK – I got an exception, let's debug… So, I click [...]

Silverlight 4 Technical Features Overview

John Papa and Adam Kinney have posted a "Silverlight 4 Technical Features Overview" on channel9 (15th April 2010). Goes into good detail about all of the new SL 4 features and gives lots of sample code.

 

I'm hoping to use this to finally figure out databound combo boxes…

Rush over and read / print the entire 75 pages at Channel9

Covers; Business Application Development, Silverlight Toolkit, MS SL 4 Tools for VS2010, WCF RIA Services, Richer UI design, Expression Blend, O-O-B (Sandboxed and Trusted apps), and [...]

“BindingExpression path error” when binding to a POCO

I'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;

        private MachineCredentials machineCreds { get; set; }

        private BackupProviderType backupProvider { get; set; }

 

        public RemoteBrowser(MachineCredentials machineCreds, BackupProviderType backupProvider)

        {

            this.machineCreds = machineCreds;

            this.backupProvider = [...]

My favourite log4net config settings

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's a good enough starting point for all my projects then it may be of interest to others.

 

This config writes to two appenders; the console and a file appender. The file appender is pretty neat in that it;

Creates log files in a logs/ folder
The standard file is "general.txt"
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 "general.txt" file is opened
Maintains a maximum of 10 renamed / archived log files (so, a total of 20MB [...]

Adding log4net to a new project - cribsheet

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.

So, here's a cribsheet for adding it in…

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

In your app.config file, add log4net to the <configSections> (if you don't have one of these, it goes at the next level down from the <configuration> element;

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>

 

Next, [...]