abp-application-layer

Guide ABP Framework application layer development with DTOs, validation, and error handling.

14.4k|3.7k|Updated Dec 3, 2016
One-click install
npx skills add https://github.com/abpframework/abp --skill abp-application-layer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: abp-application-layer
Source: https://github.com/abpframework/abp/tree/main/.claude/skills/abp-application-layer
Command: npx skills add https://github.com/abpframework/abp --skill abp-application-layer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to building robust and maintainable application layers within the ABP Framework, addressing common pitfalls and promoting best practices for services, DTOs, validation, and error handling.

Core Features & Use Cases

  • Application Service Patterns: Learn the correct structure for interfaces and implementations, including naming conventions and best practices.
  • DTO Design: Understand how to define Data Transfer Objects for various purposes (input, output, list items) and where to locate them.
  • Validation Strategies: Implement data validation using Data Annotations, IValidatableObject, and FluentValidation.
  • Error Handling: Master the use of BusinessException, EntityNotFoundException, and UserFriendlyException for effective error management.
  • Object Mapping: Utilize Mapperly for efficient compile-time object mapping or integrate with AutoMapper.
  • Use Case: When developing a new feature in an ABP application, use this Skill to ensure your application services are structured correctly, DTOs are well-defined, and validation and error handling are implemented according to ABP standards.

Quick Start

Use the abp-application-layer skill to generate a basic CreateBookDto with validation rules.

Frequently Asked Questions about abp-application-layer

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

FAQPage Schema
How do I structure application services and DTOs in the ABP Framework?

To structure ABP Framework application services, define interfaces and implementations using standard naming conventions, and design Data Transfer Objects for input, output, and list items. This ensures maintainable service layers and consistent data boundary contracts.

What is the best way to validate DTOs in an ABP application layer?

The best way to validate DTOs in an ABP application layer is using Data Annotations, IValidatableObject, or FluentValidation. These strategies enforce data integrity rules before data reaches your application service logic.

How should I handle exceptions and errors in ABP application services?

Handle errors in ABP application services by throwing BusinessException, EntityNotFoundException, or UserFriendlyException. These specialized exceptions manage application errors effectively and propagate user-friendly messages to the client.

Does ABP Framework support Mapperly for object mapping alongside AutoMapper?

Yes, ABP Framework supports object mapping with Mapperly for efficient compile-time mapping, alongside traditional AutoMapper integration. You can utilize either tool to map entities to DTOs within your application layer.

When should I use UserFriendlyException versus BusinessException in ABP?

Use UserFriendlyException to directly show error messages to clients, while BusinessException handles domain-specific rule violations with localized error codes. Both manage application layer exceptions but serve different error signaling purposes.