It is not an exaggeration to say that Dependency Injection is one of the core pillars of building modern .NET applications. It allows us to write cleaner code, both in structure but also in testability. There is a reason why since .NET Core launched (now simply .NET), it has been part of the framework and part of every codebase that is using it. It is a skill that every single .NET developer needs to master, and in this course, Nick will show you how to do just that.
What will you learn in this course?
Who is this course for and prerequisites
The problem with dependencies
Why Dependency injection is necessary
A practical example of the dependency problem
A less obvious example of a Dependency Injection use-case
Dependency injection benefits past testability
Injecting Classes vs Abstract classes vs Interfaces
So do you have to do all that manually??
The simplest setup with Dependency Injection
All of the above, in an API
The different types of dependency lifetimes
The Transient lifetime
The Singleton lifetime
The Scoped lifetime
GetService vs GetRequiredService
Generic-based registration vs implementation-based registration
The Startup.cs and changes after .NET 6
Third party libraries
Resolving dependencies in different project types
Resolving dependencies from the constructor
Resolving dependencies from the method
Resolving dependencies in a console setup
Resolving dependencies from the HttpContext
Resolving dependencies from Action Filters as Attributes
Resolving dependencies from Service Filters
Resolving dependencies from Middleware
Resolving dependencies in Minimal APIs
Resolving dependencies in Razor Views & Pages
Resolving dependencies in Blazor
Resolving dependencies in gRPC Services
Resolving dependencies in Hosted Services
Resolving dependencies in service registration
Do you need an interface for everything?
Choosing the right dependency lifetime
Dependency resolving issues and limitations
Registering open generics
Registering multiple interface implementations
Add vs TryAdd
Cleaning up service registration
Creating a custom scope
The service locator anti-pattern
When service locator makes sense
Avoiding capturing dependencies
Avoiding multiple service providers
The future of dependency injection
What is Scrutor?
Registering service decorators
Surprise optional refactoring lecture
Service registration by scanning
Using the ServiceDescriptor attribute
Why should we even bother?
Extending the main implementation
Lifetime accessBuy Course
We offer bulk discount pricing for businessesEmail sales
Nick Chapsas is a .NET & C# content creator, educator and a Microsoft MVP for Developer Technologies with years of experience in Software Engineering and Engineering Management.
He has worked for some of the biggest companies in the world, building systems that served millions of users and tens of thousands of requests per second.
Nick creates free content on YouTube and is the host of the Keep Coding Podcast.More courses by Nick Chapsas
© 2023 Dometrain. All rights reserved.