Now that we have a database to persist our model, let's ensure that our model object can use that database. In Vapor, this is done by making the model type conform to the Model protocol, and if you look at the definition of the Model, you'll see that it simply requires conformance to two other protocols:
protocol Model: Entity, Parameterizable
Let's take a look at these protocols, one at a time:
- Entity: This governs how our model object interacts with the database. We will come back to this, as our Task object does not currently conform to it.
- Parameterizable: We added conformance to this protocol for Task in the last recipe. If you need a refresher, refer to the There's more... section of the last recipe, which used resources ...