So what exactly is a Code First approach? It is exactly what it sounds like. You can model your database objects as entity classes in your code. To establish relationships between those objects, you can define a class to include other classes as member variables. If you already have an existing database, you can create an entity model in your code to represent some (or all) of your database objects.
From our Patient Records example from
, Understanding MVC, we already have a model class that represents a human. In this chapter, we will add a
RobotDoctor class to our project to build a computerized system for a futuristic hospital with robot doctors. Then, we will establish a relationship ...