Latest source (Change Set 18717) + VS2010 + .NET4 + EF4

Feb 1, 2011 at 2:51 PM

I wanted to outline the steps I took to upgrade the project and get it to compile just in case anyone else ran into the same issues I did.

  • Opening the SLN hung VS2010 due to TFS settings
    • Delete the GlobalSection(TeamFoundationVersionControl) with matching EndGlobalSection
    • I went a step further and removed all the visual source safe crufty files and test solution items since I don't use MSTest
  • The dreaded InsertAuditRecordToDatabase override cannot find a suitable method but only via the testing project
    • Go into NorthwindModel.Designer.cs (wrapped under the edmx file) and change the base type from ObjectContext to Audit.Entity.AuditableObjectContext
    • If you're using POCO entities, this is much easier to change and won't get blown away by designer changes. I'll venture so far as to say you won't even want to use this project if you're using the normal EF approach with the objectcontext hidden behind the designer.
  • Opening the emdx gives 2 mapping errors that are safe to delete (due to how FKs are used now) and also complains about it using the old EF1 schema. I did NOT choose the XML option and it opened up in the designer just peachy
  • I went anal and modified the EntitySet names from WhateverSet to the pluralized name as EF normally does now. This involved some code modification to match but it was minor

I would again stress that if you're using this with entity framework to go the POCO route or anything that allows you to define the ObjectContext externally. Trying to keep the designer.cs in sync just while I compiled was bad enough, I couldn't imagine doing this while the model is in a volatile state.

You could get away with only performing the first step and simply omit the test project from being built if you want the quickest approach.