Let’s take a look at the following points to better understand service lifetimes:
- Transient, great for lightweight, stateless services are created each time they are requested
- Scoped, created once per request.
- Singleton, created the first time they are requested or when ConfigureService is run. Every call subsequent call leverages the same instance.
As we discussed and looked at earlier in the chapter, selecting of your data source is a decision to be based on what you are looking to get out of it. Let’s take another look below. This is how I recommend which system to use, based on functional needs:
Azure SQL becomes your default relational data system for Azure, because it is fully managed and offers you automatic tuning and monitors. You can also leverage other systems, such as MySQL, PostgreSQL, and MariaDB as manager service...