Browse Source

Fix grammar and clarity in domain services guidelines

Corrected grammatical errors and improved clarity in the domain services documentation.
pull/26249/head
Tarik Ozdemir 1 month ago
committed by GitHub
parent
commit
1a2bdeb027
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 14
      docs/en/framework/architecture/best-practices/domain-services.md

14
docs/en/framework/architecture/best-practices/domain-services.md

@ -14,7 +14,7 @@
## Domain Services
- **Do** define domain services in the **domain layer**.
- **Do not** create interfaces for the domain services **unless** you have a good reason to (like mock and test different implementations).
- **Do not** create interfaces for the domain services **unless** you have a good reason to (like mocking and testing different implementations).
- **Do** name your domain service with `Manager` suffix.
For the example of a domain service:
@ -29,11 +29,11 @@ public class IssueManager : DomainService
- **Do not** define `GET` methods. `GET` methods do not change the state of an entity. Hence, use the repository directly in the Application Service instead of Domain Service method.
- **Do** define methods that only mutates data; changes the state of an entity or an aggregate root.
- **Do** define methods that only mutate data; change the state of an entity or an aggregate root.
- **Do not** define methods with generic names (like `UpdateIssueAsync`).
- **Do** define methods with self explanatory names (like `AssignToAsync`) that implements the specific domain logic.
- **Do** define methods with self-explanatory names (like `AssignToAsync`) that implement the specific domain logic.
- **Do** accept valid domain objects as parameters.
@ -45,9 +45,9 @@ public async Task AssignToAsync(Issue issue, IdentityUser user)
}
```
- **Do** throw `BusinessException` or custom business exception if a validation fails.
- **Do** throw `BusinessException` or a custom business exception if validation fails.
- **Do** use domain error codes with unique code-namespace for exception localization.
- **Do** use domain error codes with a unique code-namespace for exception localization.
```cs
public async Task AssignToAsync(Issue issue, IdentityUser user)
@ -66,10 +66,10 @@ public async Task AssignToAsync(Issue issue, IdentityUser user)
```
- **Do not** return `DTO`. Return only domain objects when you need.
- **Do not** involve authenticated user logic. Instead, define extra parameter and send the related data of ` CurrentUser` from the Application Service layer.
- **Do not** involve authenticated user logic. Instead, define an extra parameter and send the related data of ` CurrentUser` from the Application Service layer.
## See Also
* [Video tutorial](https://abp.io/video-courses/essentials/domain-services)
* [Domain Services](../domain-driven-design/domain-services.md)
* [Exception Handling](../../fundamentals/exception-handling.md)
* [Exception Handling](../../fundamentals/exception-handling.md)

Loading…
Cancel
Save