If we take a wider look at the amount of source code we have written, we can easily note how each Foreign Key spawned:
- A single-object entity property with the same type of the entity we’re referring to in the class containing the Foreign Key
- A type-defined listing property in the related class
This pattern won’t change as long as we’re defining one-to-many relationships only; an object to the left, leading to a list of related objects to the right.
Are we done with our entities? Yes. Are we ready to deploy our code-first Database? Hardly. Before doing that, we need to take care of two more things:
- Set up an appropriate Database Context.
- Enable the Code-First Migrations support within our project.
Let’s do that right now.