8. Controlling The Schema

In the last chapter we explored the basic process for creating a database and an Entity Framework model starting with a class hierarchy rather than a model. We also took a look at some basic ways that you can control what Entity Framework will do (and when it will do it) when it creates the model (and possibly the database).

But as reasonable as the basic Code First conventions are, there are some things that Entity Framework can’t work out by itself. Complicated relationships, for example, or some database-specific attributes of the table fields. Fortunately, there are several ways you can control the ultimate database, and we’ll examine two in this chapter.

Data annotations are a set of metadata attributes that work ...

Get Fluent Entity Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.