So I finally got around to trying Entity Framework with POCOs, where the domain model objects were hand coded and there was an aleady existing database.
The process was initially simple: run the tool that creates a model diagram of the database, turn off code generation, write an objectcontext, and some data repositories. Job nearly done.
The initial error message upon running the first unit test was a tad vague…
“Metadata information not found…” for one of the entities.
To cut a long story short, you need to check that everything matches exactly. Navigation properties and FKs are the most likely to give the error given. Once you find the worst errors, the messages in the exceptions tend to get much more helpfull, down to pointing out which property it cant find.
In my case it mostly involved editing the model to get the property names right, and more importantly remove some navigation properties that my domain model did not require.
It went from this:
to this: (play spot the difference).

