dependency-injection

Community

Master .NET Dependency Injection

AuthorAlexanderRadevich
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill helps developers understand and implement effective Dependency Injection (DI) patterns in .NET, addressing common pitfalls and promoting robust, maintainable code.

Core Features & Use Cases

  • Service Lifetimes: Explains Singleton, Scoped, and Transient lifetimes with clear examples.
  • Keyed Services: Demonstrates .NET 8+ keyed services for strategy patterns.
  • Decorator Pattern: Shows how to add cross-cutting concerns like logging.
  • Convention Registration: Utilizes Scrutor for efficient assembly scanning.
  • Anti-patterns: Highlights and provides solutions for common DI mistakes like service locator usage and capturing scoped services in singletons.
  • Use Case: Resolve issues with DbContext lifetimes in a web API, implement a strategy pattern for different payment gateways, or refactor code to use constructor injection instead of service locator.

Quick Start

Use the dependency-injection skill to understand how to register a scoped service with the name 'IOrderService' and its implementation 'OrderService'.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: dependency-injection
Download link: https://github.com/AlexanderRadevich/SportowyHub_clientApp/archive/main.zip#dependency-injection

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.