C# Dependency Injection
For professional developers, dependency injection is an important technique to keep your codebase testable and maintainable. This course will teach you how to implement dependency injection when working with C#.
What you'll learn
Inversion of Control (IoC), implemented through dependency injection, is one of the five principles of object-oriented software design. Every developer who writes code for a living needs to master this topic. In this course, C# Dependency Injection, you’ll learn to add dependency injection to your applications. First, you’ll explore how to configure a dependency container, resolve dependencies, and master lifetime management. Next, you’ll discover intermediate and advanced techniques for effectively managing configuration and HTTP connections, how the different lifetimes work in detail, and how you can use that to your advantage. Finally, you’ll learn how to spot common mistakes, errors, and scenarios, and how to approach them using advanced techniques. When you’re finished with this course, you’ll have the skills and knowledge to add dependency injection to solutions of every size.
Table of contents
- Introduction 2m
- Demo: Introducing Dependency Injection 7m
- Checkpoint 01 - Applying Constructor Injection 0m
- Demo: Adding a DI Container 7m
- Checkpoint 02 - Registering a dependency 0m
- Checkpoint 03 - Resolving a dependency 0m
- About Dependency Injection Containers 6m
- Dependency Inversion and Inversion of Control 5m
- Creating Maintainable Solutions Using Dependency Injection 2m
- Summary 1m
- Introduction 1m
- Demo: Reusing an Instance 4m
- Checkpoint 04 - Registering a Singleton Dependency 0m
- About the Different Lifetimes 6m
- Demo: Transforming Products 6m
- Checkpoint 05 - Registering a Scoped Dependency 0m
- Exercise 01 - Working with a ScopeFactory 0m
- Demo: Dependency Captivity 6m
- Checkpoint 06 - Enable scope validation 0m
- Which Lifetime to Select 5m
- Demo: Choosing the Correct Lifetime 6m
- Summary 1m
- Introduction 1m
- Demo: Separating out the Entrypoint 6m
- Checkpoint 07 - Add a composition root 0m
- Demo: Organizing Registrations 4m
- Demo: Application Configuration 6m
- Checkpoint 08 - Register an Options type 0m
- Demo: Multiple Implementing Types 4m
- Demo: Injecting Httpclient 5m
- Checkpoint 09 - Register a HttpClient with a BaseAddress 0m
- Demo: Service Locator Pattern 4m
- Exercise 02 - Refactoring away from Service Locator 0m
- Demo: DI and Unit Testing 5m
- Demo: Optional Dependencies 3m
- Summary 1m
- Introduction 1m
- Demo: Implementing Multiple Service Types from One Implementing Type 4m
- Exercise 03 - Implementing Multiple Service Types from one Implementing Type 0m
- Hanging State 3m
- Demo: Dealing with Dependencies That Are Expensive to Instantiate 4m
- Checkpoint 10 - Registering a Lazy Implementing Type 0m
- Demo: Constructor Arguments That Depend on Context 3m
- Exercise 04 - Adding an indirection through Factory 0m
- Dependency Injection and IDisposable 4m
- Demo: Dependency Injection and IDisposable 4m
- Summary 1m
- Summary 1m
- Demo: A/B Testing 6m
- Demo: Choosing Another Container 3m
- Demo: Switching to autofac 7m
- Checkpoint 11 - Switching to Autofac 0m
- Demo: Optional and Missing Dependencies 5m
- Exercise 05 - Working with property injection 0m
- Interception 3m
- Demo: Interception 3m
- Exercise 06 - Adding interception 0m
- Demo: Assembly Scanning 3m
- Checkpoint 12 - Using assembly scanning 0m
- Summary 1m
- Thank You 1m