Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Beginners Guide to Dependency Injection for C# Developers
Rating: 4.3 out of 5(557 ratings)
18,779 students

Beginners Guide to Dependency Injection for C# Developers

Learn the basics of Dependency Injection techniques.
Created byEngineer Spock
Last updated 7/2020
English
English [Auto],

What you'll learn

  • Apply DIP
  • Understand the Concept of DI and how to apply it in practice

Course content

2 sections20 lectures1h 9m total length
  • About the Course0:22
  • Join .NET Community of Students0:02
  • Outline1:35

    Outline the dependency inversion principle and its relation to inversion of control and dependency injection; explore dependencies, refactoring techniques, architectural implications, and building a simple container with a non-trivial example.

  • Definition of DIP3:30

    Explore the dependency inversion principle by contrasting tight and loose coupling, showing how high level modules depend on abstractions, while details depend on those abstractions to achieve decoupling.

  • Dependencies4:49

    Define dependency types, emphasize how high-level domain objects depend on low-level infrastructure, and show how to decouple via interfaces to enable dependency injection and runtime flexibility.

  • Volatile and Stable Dependencies2:53

    Compare volatile versus stable dependencies, highlighting environment-driven, under-development, and non-deterministic behavior from databases, external systems, or time and randomness; use indirection and test doubles to enable unit testing.

  • Definitions of IoC and DI3:18

    Define IoC and DI, distinguish inversion of control and dependency inversion principle, and present dependency injection as a technique for loosely coupled code.

  • DIP Violation Demo2:47

    Demonstrate a dependency injection violation with a divergence checker tightly coupled to a counter and a fiscal register device, and explain why unit tests fail without proper injection.

  • Refactoring to a Better Design Applying DI8:31

    Learn how to apply dependency injection to refactor untestable designs by exposing dependencies via constructor, property, or method injection, and verify with unit tests using test doubles.

  • Dependency Injection Techniques7:09

    Explore dependency injection techniques for C# developers, including constructor, method, and property injection, and learn how SRP guides grouping of dependencies and using containers.

  • Architectural Implications5:24

    Explore how inverting dependencies creates boundaries and plugins around domain logic. See onion/hexagonal and ports-and-adapters architectures and how main sets up dependencies.

  • Common Smells of DIP Violation2:37

    Identify common smells of dip violation, including hidden and non deterministic dependencies, and extract a layer of indirection using adapters and test doubles.

  • Conclusion2:03

    Summarizes the core ideas of dependency inversion and injection, explains stable and unstable (volatile) dependencies, and compares constructor, property, and method injection within a ports and adapters architecture.

Requirements

  • Solid experience in C#

Description

Teaching Approach

No fluff, no ranting, no beating the air. I esteem your time. The course material is succinct, yet comprehensive. All the important concepts are covered. Particularly important topics are covered in-depth. For absolute beginners, I offer my help on Skype absolutely free, if requested.

Take this course, and you will be satisfied.

Build a solid foundation in software architecture applying Dependency Injection

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.

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. 

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

Who this course is for:

  • Any C# developer who wants to learn about Dependency Injection