Overview
HGT EAM WebServices is built following Clean Architecture principles with CQRS (Command Query Responsibility Segregation) pattern using the Mediator pattern for request handling. The solution provides a RESTful API layer over Infor EAM’s SOAP-based grid services.Solution Structure
The solution consists of three main projects:Project Responsibilities
HGT.EAM.WebServices (Application Layer)
HGT.EAM.WebServices (Application Layer)
The main API project containing:
- Controllers: REST API endpoints that inherit from
BaseGridController - Queries: CQRS query objects using Mediator pattern
- Models: Request/response DTOs
- Mapper: Mapster configuration for object mapping
- Setup: Application configuration and dependency injection
Program.cs- Application entry pointStartup.cs- Service configuration and middleware pipelineServiceCollectionExtensions.cs- Dependency injection setup
HGT.EAM.WebServices.Conector (Integration Layer)
HGT.EAM.WebServices.Conector (Integration Layer)
Handles external SOAP service communication:
- Services:
EAMGridService- SOAP client wrapper - Interfaces: Service contracts
- Models: DTOs for EAM integration
- Extensions: Helper methods for data transformation
- Connected Services: Auto-generated SOAP client proxies
- SOAP client configuration with WCF
- X.509 certificate handling
- Request/response transformation
HGT.EAM.WebServices.Infrastructure (Shared Layer)
HGT.EAM.WebServices.Infrastructure (Shared Layer)
Architecture Patterns
Clean Architecture Layers
The architecture follows the dependency rule: inner layers know nothing about outer layers.CQRS with Mediator Pattern
All requests flow through the Mediator pattern, providing separation of concerns and testability. Request Flow: Implementation Example:Base Controller Pattern
All controllers inherit fromHGTController, which provides:
- Mediator integration for CQRS
- Consistent error handling
- Logging infrastructure
- Standardized response formatting
HGT.EAM.WebServices.Infrastructure/Architecture/Controller/HGTController.cs
Component Interaction
Request Processing Pipeline
Middleware Stack (defined inStartup.cs:98-100):
- ExceptionMiddleware - Global exception handling
- ResponseMiddleware - Response formatting and transformation
- QueryParamsValidationMiddleware - Request validation
Dependency Injection
Services are registered inServiceCollectionExtensions.cs:12-36:
Configuration Structure
The application requires the following configuration sections:- appsettings.json
Key Design Decisions
CQRS Pattern
Separates read operations (queries) from write operations for better scalability and maintainability.
Mediator Pattern
Reduces coupling between controllers and business logic, enabling easier testing and maintenance.
SQLite Cache
Provides persistent caching without external dependencies, ideal for containerized deployments.
Streaming Data
Fetches large datasets in batches (5000 records) to minimize memory consumption.
Performance Considerations
See the Caching documentation for details on how the cache system optimizes performance.
Next Steps
Caching System
Learn how the SQLite cache dramatically improves response times
Authentication
Understand how Basic Auth and rate limiting protect the API
API Reference
Explore the available endpoints and request formats
Quick Start
Get started with your first API request