ABP Dependency Injection Skill

Configures ABP Framework dependency injection via conventions and attributes.

13|4|Updated May 27, 2026
One-click install
npx skills add https://github.com/burakdmir/abp-skills --skill abp-dependency-injection-skill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ABP Dependency Injection Skill
Source: https://github.com/burakdmir/abp-skills/tree/main/claude/abp-dependency-injection
Command: npx skills add https://github.com/burakdmir/abp-skills --skill abp-dependency-injection-skill

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the confusion of how ABP Framework registers and resolves dependencies, so your services get the right lifetimes and interfaces without brittle manual wiring.

Core Features & Use Cases

  • Conventional DI registration: Automatically registers services by implementing ITransientDependency, ISingletonDependency, or IScopedDependency.
  • Explicit control: Uses [Dependency] to set Lifetime, TryRegister, and ReplaceServices for safe overrides.
  • Interface exposure control: Uses [ExposeServices] to control which interfaces are injectable.
  • ABP DI container requirements: Covers when and why Autofac is needed for dynamic proxying (UoW, validation, authorization, auditing, feature checking).
  • Practical scenarios: Override a framework service, choose correct lifetimes for caches/request state, and avoid the service locator pattern.

Quick Start

Ask the skill how to register or override an ABP service so it can be injected with the correct interface and lifetime.

Frequently Asked Questions about ABP Dependency Injection Skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does dependency injection work in ABP Framework?

ABP Framework dependency injection conventionally registers services by implementing marker interfaces like ITransientDependency, ISingletonDependency, or IScopedDependency. It resolves dependencies automatically without manual service wiring code.

How do I override an existing service registration in ABP?

To override an existing service registration in ABP, apply the [Dependency] attribute with the ReplaceServices option. This safely swaps the default framework implementation with your custom service while preserving the original dependency injection lifecycle.

When do I need Autofac for ABP dependency injection?

You need Autofac for ABP dependency injection when your services require dynamic proxying for cross-cutting concerns like Unit of Work, validation, authorization, auditing, and feature checking. The default Microsoft DI container does not support these interception mechanisms.

How do I control which interfaces are exposed for dependency injection in ABP?

To control which interfaces are exposed for dependency injection in ABP, apply the [ExposeServices] attribute to your service class. This restricts the injectable interfaces, ensuring only explicitly specified contracts are registered and resolvable by the DI container.

What is the difference between ABP dependency lifetimes?

ABP dependency lifetimes define instance scope: ITransientDependency creates a new instance per injection, IScopedDependency shares instances within a single request, and ISingletonDependency maintains a single application-wide instance for caching or global state management.

Can I use the [Dependency] attribute to set service lifetime in ABP?

Yes, you can use the [Dependency] attribute to set service lifetime in ABP alongside configuring TryRegister and ReplaceServices. This provides explicit control over the dependency injection behavior, overriding conventional interface-based registrations.