It’s time to delve deeper into the Entity Framework and work
directly with its core components: the
These are truly the two workhorses of the Entity Framework. Under
the covers, Object Services uses the classes in these two APIs extensively
to interact with objects at a granular level. Most of the classes and
methods are public, so you can use
MetadataWorkspace in your own applications to
control and manipulate entity objects.
Separately or together, these two classes not only allow you to manipulate entities, but also enable you to write generic methods that you can use on various Entity Framework object types, as well as dynamically create objects at runtime without depending on the generated entity classes.
Along with learning the concepts of
MetadataWorkspace, you will find many code
samples in this chapter that you can use in your applications. For
example, you will find a set of extension methods to overload the
GetObjectStateEntries method and a utility for
inspecting in-memory entities at runtime.
You will learn how to interact with entities and entity state
ObjectStateManager and build the State
Entry Visualizer that you saw in Chapter 10. Then you will learn about
interacting with the raw metadata using the
Later in the chapter, you will build more samples that will give you ...