Summary
In this chapter, we changed to using persistent storage with the API service using a relational and a NoSQL database. We created the database context to map the Game
and Move
types to tables in a relational database and to a JSON document with a NoSQL database – both using EF Core.
To select which database to use in your environment, if you have relational data with a fixed schema, select SQL Server. If the schema is not required in your scenario, and changes to the data happen often, a NoSQL database can be the best option.
You learned about how to map objects and how to deal with special mapping requirements based on the object model. Using a relational database, you also learned how to create migrations to update the database schema and to initially create the database.
You learned how to use database resources with the .NET Aspire application model specified with the AppHost
project.
Before starting the next chapter, it’s well deserved to play...