Chapter 8. Plain Old CLR Objects

Objects should not know how to save themselves, or load themselves, or filter themselves. That's a familiar mantra in software development and especially in Domain Driven Development. There is a good bit of wisdom in the mantra. Having persistence knowledge bound too tightly to our domain objects complicates testing, refactoring, and reuse. The classes generated by Entity Framework for our model entities are heavily dependent on the plumbing of Entity Framework. For some developers, these classes know too much about the persistence mechanism and are too closely tied to the concerns of models and mapping. There is another option.

The Entity Framework also supports using your own classes for the entities in the model. ...

Get Entity Framework 4.0 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.