paint-brush
How to Create a Dependency Aggregate Class to Manage DI: Clearly Exemplifiedby@samwalpole
730 reads
730 reads

How to Create a Dependency Aggregate Class to Manage DI: Clearly Exemplified

by Sam Walpole5mApril 21st, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Dependency injection (DI) is a wonderful thing, but inherited classes can be a real pain. The problem comes when I want to add more dependencies to the base class. I typically create a Request Handler base class that contains common dependencies and functionality. Each concrete request handler can then inherit from this base class, inheriting the new dependency as well. The solution to this problem is to create a Dependency Aggregate class that injects the dependencies directly into the constructor of the class.

Company Mentioned

Mention Thumbnail
featured image - How to Create a Dependency Aggregate Class to Manage DI: Clearly Exemplified
Sam Walpole HackerNoon profile picture
Sam Walpole

Sam Walpole

@samwalpole

Fullstack .NET and JavaScript web developer. Coding teacher and advocate

About @samwalpole
LEARN MORE ABOUT @SAMWALPOLE'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Sam Walpole HackerNoon profile picture
Sam Walpole@samwalpole
Fullstack .NET and JavaScript web developer. Coding teacher and advocate

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here