Learn the most common dependency injection errors in ASP.NET Core, including scoped from singleton issues, unregistered services and incorrect service lifetimes.
Learn how to write xUnit tests for a class that injects services that uses ASP.NET Core dependency injection using mock and real instances.
Learn how to resolve scoped and transient services in an ASP.NET Core background service by creating a new scope and how it can also be used for multithreading.
Find out whether you should use the GetService or GetRequiredService method in the IServiceProvider type to resolve a service from ASP.NET Core dependency injection.
Learn how to add and inject keyed services into an ASP.NET Core application so you can add multiple implementations of the same services.
We'll show you how to use dependency injection to inject services into controllers, minimal APIs, Razor views and middleware in an ASP.NET Core application.
Learn the difference between singleton, scoped and transient service lifetimes in ASP.NET Core dependency injection, with examples of when to use each one.
Learn how to create a ValueConverter in Entity Framework Core to save dates as UTC in the database & convert them back to your local time zone in ASP.NET Core.
Learn how to Dockerize an ASP.NET Core Web API by writing a Dockerfile to restore, build and publish your .NET application to a Docker container.
Static asset delivery optimisation in .NET 9 uses Brotli and Gzip compression for static asset files which can reduce the file size by over 80%.