Software Architecture: Dependency Injection for C# Developers

Software Architecture: Dependency Injection for C# Developers

What You'll Learn

Apply DIP
Use DI-Containers
Use IoC-Containers
Improve Architecture


Build a solid foundation in software architecture applying Dependency Injection with IoC-Containers 

In many of my courses, I use techniques of Dependency Injection and each time students write me private messages saying that they don't what it is and thus they don't understand what's going on in the course I teach. This is very unfortunate from the learning perspectives.

Dependency Injection is the set of techniques that allow to supply dependencies to objects. Actually, if you have ever passed dependencies via constructors, then you applied the so-called constructor injection. Dependency Injection (DI) is simple and difficult at the same time. On one hand, DI is comprised of simple techniques and on the other hand, when we need to bring DI to the next level, we need to make things more complicated using the so-called DI or IoC (Inversion of Control) Containers. These are the frameworks which perform dependency injection automatically. You just need to set one up in the application root (an extremely important notion which you'll learn about in the course) and after that, it will resolve all the dependencies it knows about in the runtime.

If you still don't understand what am I talking about, just believe me, you absolutely need to know about Dependency Injection. This course will tremendously improve your understanding of how software architectures emerge. So, this course is "must watch" for anyone who still doesn't understand what is DI and IoC-Containers.

Content and Overview

This course is aimed at all kind of developers. It provides solid theoretical base reinforced by the practical material.

The course covers:

  • Introduction to Inversion of Control:  
    Dependency Inversion Principle (DIP), Inversion of Control (IoC), Dependency Injection (DI), 
    Dependencies and their types, Pure DI and IoC-Containers, Service Locator 
  • The Architectural Implications of Dependency Injection 
  • DI-related Anti-Patterns & Refactorings:  
    Control Freak, Hidden Dependencies, Temporal Coupling, 
    Constructor Over-Injection and how to avoid it, 
    Ambient Context, Facade Service, Property Injection vs Bastard Injection, Cyclic Dependencies 
  • Refactoring Example of an existing code base applying Dependency Injection 
  • How to reap the fruits of DI 
  • DI-Containers (IoC-Containers): 
    Overview, Unity, Late Binding with Unity, Aspect-Oriented Programming (AOP), Interception vs Pure DI vs AOP Tools, 
  • Setting up a bootstrapper with Unity, Autofac and Castle.Windsor







Try for 30 days

Try Now

30 day money back guarantee


How to Ask Questions
How to Ask Question
Download Source Code and Slides
Dependency Inversion Principle and Dependency Injection
1:34 Ouline
3:31 Definition of DIP
4:13 Dependencies
2:53 Volatile and Stable Dependencies
3:19 Definitions of IoC and DI
2:25 DIP Violation Demo
8:12 Refactoring to a Better Design Applying Dependency Injection
5:54 Dependency Injection Techniques
5:24 Architectural Implications
2:11 Common Smells of DIP Violation
2:15 Conclusion
Introduction to IoC-Containers (or DI-Containers)
1:10 Outline
4:31 Pure DI and IoC-Containers
3:56 Building a Simple IoC-Container
2:44 Service Locator Design Pattern
10:27 Demo With an IoC-Container
1:17 Conclusion
Dependency Injection - Related Anti-Patterns & Refactorings
1:57 Outline
7:23 Control Freak
4:19 Hidden Dependencies with Service Locator
1:48 Temporal Coupling and Constructor Injection
4:60 Constructor Over-Injection
2:58 Facade Service
3:39 Ambient Context
3:34 Property Injection VS Bastard Injection
11:34 Cyclic Dependencies
2:35 Conclusion
Dependency Injection Real-World Example
1:13 Outline
1:25 Application Overview
2:00 Data Access and Models
3:19 UI-Side
3:26 The Problem of Tight Coupling
10:38 Refactoring Process
4:37 Isolating the Bootstrapper
1:54 Consequences
1:14 Conclusion
Reaping the Fruits of DI
0:27 Outline
9:40 Adding New DAL
10:20 Writing Unit Tests for View Models
0:46 Conclusion
DI-Containers (IoC-Frameworks)
1:35 Outline
3:47 Overview of DI-Containers
10:25 Unity DI-Framework
5:30 Late Binding with Unity
3:50 Aspect-Oriented Programming (AOP)
4:60 Demonstration of the Problem of Boilerplate Code
5:28 Implementing AOP by Intercepting
2:40 Interception vs Pure DI vs AOP Tooling
4:30 Autofac and Castle.Windsor DI-Containers
1:58 Problems Related to DI-Containers
0:57 Conclusion
BONUS Lecture

How It Works



Each course is like an interactive textbook with pre-recorded videos, quizzes and projects.
Peer Support


Connect with thousands of other learners to debate ideas, discuss course material, and get help mastering new concepts.

Your Teacher