Update AGENTS.md and csproj for ECMJobRunner.Application
Added detailed documentation to AGENTS.md, including project overview, architecture, components, and usage examples for the ECMJobRunner.Application layer. Documented target frameworks (.NET Framework 4.8 and .NET 8.0) and their dependencies (AutoMapper and MediatR). Updated ECMJobRunner.Application.csproj: - Changed `<Product>` tag to reflect the correct project name. - Added a project reference to ECMJobRunner.Domain. - Introduced conditional NuGet package references for framework-specific dependencies.
This commit is contained in:
186
ECMJobRunner.Application/AGENTS.md
Normal file
186
ECMJobRunner.Application/AGENTS.md
Normal file
@@ -0,0 +1,186 @@
|
||||
# ECMJobRunner.Application
|
||||
|
||||
## Project Overview
|
||||
|
||||
ECMJobRunner.Application is the **application layer** for the ECM Job Runner system following **Clean Architecture** principles. This project contains:
|
||||
- **Application services** and business logic
|
||||
- **DTOs (Data Transfer Objects)** for external communication
|
||||
- **AutoMapper profiles** for entity-DTO mapping
|
||||
- **MediatR handlers** for CQRS pattern (Commands/Queries)
|
||||
- **Validators** for business rules
|
||||
|
||||
**Key Principle**: This layer orchestrates application workflows, coordinates domain logic, and implements use cases.
|
||||
|
||||
## Target Frameworks
|
||||
|
||||
- **.NET Framework 4.8** (`net480`)
|
||||
- AutoMapper 10.1.1
|
||||
- MediatR 9.0.0
|
||||
|
||||
- **.NET 8.0** (`net8.0`)
|
||||
- AutoMapper 13.0.1
|
||||
- MediatR 12.4.1
|
||||
|
||||
The project uses conditional NuGet package references to support both frameworks.
|
||||
|
||||
## Architecture
|
||||
|
||||
This project follows **Clean Architecture** principles:
|
||||
- **Depends on Domain layer** (uses entities and repository interfaces)
|
||||
- **Independent of Infrastructure** (uses dependency injection for repositories)
|
||||
- **CQRS pattern** via MediatR (Commands and Queries)
|
||||
- **AutoMapper** for DTO mapping
|
||||
- **Validation** for business rules
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
ECMJobRunner.Application/
|
||||
├── DTOs/ # Data Transfer Objects (to be created)
|
||||
├── MappingProfiles/ # AutoMapper profiles (to be created)
|
||||
├── Commands/ # MediatR command handlers (to be created)
|
||||
├── Queries/ # MediatR query handlers (to be created)
|
||||
├── Validators/ # Business rule validators (to be created)
|
||||
├── Services/ # Application services (to be created)
|
||||
├── ECMJobRunner.Application.csproj
|
||||
└── AGENTS.md # This file
|
||||
```
|
||||
|
||||
## Planned Components
|
||||
|
||||
### DTOs (Data Transfer Objects)
|
||||
Will contain data transfer objects for external communication:
|
||||
- `ProfileDto` - Profile data transfer object
|
||||
- `ProfileSqlJobDto` - SQL job data transfer object
|
||||
- `ProfileHistoryDto` - History data transfer object
|
||||
|
||||
### AutoMapper Profiles
|
||||
Will contain mapping configurations:
|
||||
- `ProfileMappingProfile` - Maps between entities and DTOs
|
||||
|
||||
### MediatR Handlers
|
||||
|
||||
**Commands** (write operations):
|
||||
- `CreateProfileCommand` / `CreateProfileCommandHandler`
|
||||
- `UpdateProfileCommand` / `UpdateProfileCommandHandler`
|
||||
- `DeleteProfileCommand` / `DeleteProfileCommandHandler`
|
||||
|
||||
**Queries** (read operations):
|
||||
- `GetProfileByIdQuery` / `GetProfileByIdQueryHandler`
|
||||
- `GetAllProfilesQuery` / `GetAllProfilesQueryHandler`
|
||||
- `GetActiveProfilesQuery` / `GetActiveProfilesQueryHandler`
|
||||
|
||||
### Validators
|
||||
Will contain business rule validation:
|
||||
- `CreateProfileCommandValidator`
|
||||
- `UpdateProfileCommandValidator`
|
||||
|
||||
### Services
|
||||
Application services orchestrating business workflows:
|
||||
- `ProfileService` - Profile management service
|
||||
- `JobExecutionService` - Job execution orchestration
|
||||
|
||||
## Dependencies
|
||||
|
||||
### .NET Framework 4.8 (`net480`)
|
||||
- **ECMJobRunner.Domain** (project reference)
|
||||
- **AutoMapper 10.1.1** (NuGet package)
|
||||
- **MediatR 9.0.0** (NuGet package)
|
||||
|
||||
### .NET 8.0 (`net8.0`)
|
||||
- **ECMJobRunner.Domain** (project reference)
|
||||
- **AutoMapper 13.0.1** (NuGet package)
|
||||
- **MediatR 12.4.1** (NuGet package)
|
||||
|
||||
## CQRS Pattern with MediatR
|
||||
|
||||
The application uses the **CQRS (Command Query Responsibility Segregation)** pattern:
|
||||
|
||||
- **Commands**: Modify state (Create, Update, Delete)
|
||||
- **Queries**: Read state (Get, List, Find)
|
||||
|
||||
**Benefits:**
|
||||
- Clear separation of read/write operations
|
||||
- Easier to test and maintain
|
||||
- Better scalability
|
||||
- Loose coupling
|
||||
|
||||
## AutoMapper Configuration
|
||||
|
||||
AutoMapper is used to map between domain entities and DTOs:
|
||||
|
||||
**Example mapping:**
|
||||
```csharp
|
||||
public class ProfileMappingProfile : Profile
|
||||
{
|
||||
public ProfileMappingProfile()
|
||||
{
|
||||
CreateMap<Profile, ProfileDto>();
|
||||
CreateMap<CreateProfileCommand, Profile>();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Building the Project
|
||||
|
||||
```bash
|
||||
dotnet build ECMJobRunner.Application.csproj
|
||||
```
|
||||
|
||||
For specific framework:
|
||||
```bash
|
||||
dotnet build ECMJobRunner.Application.csproj -f net8.0
|
||||
dotnet build ECMJobRunner.Application.csproj -f net480
|
||||
```
|
||||
|
||||
## Known Warnings
|
||||
|
||||
AutoMapper versions have known security vulnerabilities (NU1903):
|
||||
- AutoMapper 10.1.1 (for .NET Framework 4.8)
|
||||
- AutoMapper 13.0.1 (for .NET 8.0)
|
||||
|
||||
**Note**: These are the highest compatible versions for the respective frameworks. The vulnerabilities are related to expression compilation and should be evaluated based on your security requirements.
|
||||
|
||||
## Usage Example
|
||||
|
||||
```csharp
|
||||
// Using MediatR to get a profile
|
||||
var query = new GetProfileByIdQuery { Id = 123 };
|
||||
var profileDto = await mediator.Send(query);
|
||||
|
||||
// Using MediatR to create a profile
|
||||
var command = new CreateProfileCommand
|
||||
{
|
||||
ProfileName = "New Profile",
|
||||
Active = true,
|
||||
TypeId = 2
|
||||
};
|
||||
var newProfileId = await mediator.Send(command);
|
||||
```
|
||||
|
||||
## Development Notes
|
||||
|
||||
- **Clean Architecture**: Application layer uses domain interfaces, not implementations
|
||||
- **Dependency Injection**: Infrastructure implementations injected at runtime
|
||||
- **CQRS**: Separate models for read and write operations
|
||||
- **Validation**: Business rules validated before command execution
|
||||
- **Mapping**: AutoMapper handles entity-DTO conversion
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
1. Add FluentValidation for complex validation rules
|
||||
2. Add caching layer for frequently accessed data
|
||||
3. Add logging with Serilog
|
||||
4. Add application events for cross-cutting concerns
|
||||
5. Add background job scheduling integration
|
||||
|
||||
## Related Projects
|
||||
|
||||
- **ECMJobRunner.Domain**: Contains entities and repository interfaces
|
||||
- **ECMJobRunner.Infrastructure**: Provides repository implementations
|
||||
|
||||
## Company Information
|
||||
|
||||
**Author**: Digital Data GmbH
|
||||
**Copyright**: 2026
|
||||
**Repository**: http://git.dd:3000/AppStd/ECMJobRunner.git
|
||||
Reference in New Issue
Block a user