Resources related to vanilla dependency injection. Moved from the training examples repository.
-
Krzysztof Koźmic - IoC container solves a problem you might not have but it’s a nice problem to have
-
Yacoub Massad - Why DI containers fail with “complex” object graphs
-
Dan North - Why Every Element of SOLID is Wrong - source of the phrase "new is the new new" and "Assemble into small components that fit in your head".
-
Vaughn Vernon - Your Brain on Inversion of Control and Dependency Injection - the section
Dependency Injection without an IoCC
- Mark Seemann - Dependency Whac-a-mole
- Jimmy Bogard - You Probably Don't Need to Worry About MediatR - the section
[Violates] the Explicit Dependencies Principle
- Vanilla DI vs a DI container
- Automatic dependency resolution (
_1_AutomaticDependencyResolution
and handcoded)- When is not helping
- When is helping - reusing recipe
- When is not helping again - multiple recipes for the same type
- Minimizing recipe reuse problem in Vanilla DI with local functions -
_1_AutomaticDependencyResolution
- Managing scopes (
_2_LifestyleMagament
)- Container example
- Vanilla DI and manual Dispose
- What if Dispose throws an exception?
- Disposal subsystem
- Handling missing dependencies (
MissingDependency.cs
)- Container - without validation
- Container - with validation
- Container - with lambda registration
- Vanilla DI - compile time
- Circular dependencies (
CircularDependencies.cs
)- Uncomment assertions
- CD without container validations
- CD with container validations
- CD with container and lambdas (!!)
- Conclusion: avoid lambdas in MsDi
- CD with Vanilla DI
- Dead code detection (
DeadCode.cs_
) - Extracting code into libraries (
ExtractingLibrary.cs
) - Extracting dependencies from constructor (handcode)
- Simple vs complex dependency graphs
- Multiple lifestyles for different instances of a type (
MultipleLifestylesOfInstancesTheSameClass.cs
) - Decorators/composites (
DecoratorsWithMultipleChains.cs
)- Optional - different syntaxes for containers (autofac, scrutor)
- Similar subgraphs differing with leaves.
MultipleObjectOfSameTypeConfiguredDifferentlyAndNamingPropagation2.cs
- with polymorphism- Vanilla DI
- MsDi without modules
- MsDi with modules
- Vanilla DI with refactoring
- [Optional - can also be discussed in aspnet core example] Graph readability
- [Optional - needs more code] Multiple constructors & factory methods
- [Optional - needs more code] Passing literals into constructors
- Automatic dependency resolution (
- How to integrate Vanilla DI into ASP.NET Core? (
BasicIntegration
)- Composition root object
- Minimal API
- Controllers
- SignalR
- How to do Vanilla DI well and scale it?
- Refactoring object composition - simple techniques
- Decomposing object composition into components
- Testing subcomponents