Starting with ADO.NET Entity Framework in Orcas beta 1

Orcas is bringing two similar but different LINQed ORM approaches: LINQ to SQL and Entity Framework/LINQ to Entities. I thought that it is about time to try out the later, so I created a new project and fired up Entity Data Model (EDM) Wizard (the only way to avoid typing all that XML definitions for now*). The result was a bunch of empty xml and code files. Oops. Fortunately I was aware that a EDM wizard hot fix is out. Once the fix is installed, I re-run the wizard, picked a couple of tables from a Northwind database and finished the process. This time the definition and code files were generated just fine. At least I thought so. Next step is to create an instance of strong typed ObjectContext, like this:

NorthwindEntities db = new NorthwindEntities();

Yet, I got a "At least one of the input paths does not exist." exception each time I've tried to run that simple piece of code that is supposed to run without problems. Hm. My first thoughts were that strong typed NorthwindEntities ObjectContext class is passing wrong arguments to supertype ObjectContext constructor. After a couple of tests I saw that the arguments were correct. So, what is wrong. The answer is, of course, in exception message. I think it is saying that some types are missing or something like that. I correlated this fact to the selection of only a couple of tables in wizard instead of selecting all of them. So I re-run the wizard once more, this time selecting all tables. This time it worked smoothly - seems like the third iteration is the good one.

The bottom line is that if you want to play with Entity Framework you have to:

  • Install EDM Wizard hot fix
  • Always include all tables (or modify entity model definitions, mappings, etc by hand)
  • or type XML like mad

* ADO.NET team has a video of an EDM designer prototype which looks really cool. But, what really sucks is the sentence "that we can expect to see released after the upcoming Orcas release". Yes, you've read it right. No EDM designer for Orcas release. This is like having to assembly a (fast sports) personally car before driving it. On the bright side though: your XML and typewriting skills will have opportunity to shine.