Writing Data to Relational and NoSQL Databases
After creating the first implementation of the service using minimal APIs, we build on that to read and write to databases. In this chapter, we will replace the in-memory repository built in Chapter 2 using Entity Framework Core (EF Core) to access a relational database – Microsoft SQL Server – and an Azure Cosmos DB NoSQL database using EF Core.
You’ll create two libraries to access these databases, create EF Core context classes, specify the mappings from model classes, and configure the minimal APIs service to use one or the other database. After adding these changes, the games will be persisted and you can continue game runs when the service is restarted.
In this chapter, you’ll be exploring these topics:
- Exploring the models for the data to be stored in the databases
- Creating and configuring an EF Core context to access Microsoft SQL Server
- Creating migrations to update the database...