Validation Service & Core Architecture Services
Mastering Request Validation, InMemory Caching, SQL Views, and External Provider Integration in AUA
1. Validation Service
One of the most vital services of the AUA framework is request validation. All incoming requests are strictly validated prior to processing, covering data structures, foreign keys, and business rules. Custom view model validators can be created within minutes, boosting performance and preventing unnecessary resource waste while seamlessly supporting multiple error structures.
Essential Architecture Services
Stores low-volume, rarely modified reference data (e.g., basic info, user access) directly in RAM to eliminate redundant database queries. Supports local server memory or distributed solutions like Redis alongside automatic update mechanisms.
Bypasses standard EF limitations by allowing developers to map SQL Views directly to custom objects and apply advanced runtime filtering on virtual multi-table datasets.
Facilitates seamless, clean third-party integrations (SMS panels, payment gateways, microservice communication) using dedicated, standardized communication patterns.
Dedicated layer responsible solely for mapping and converting external third-party models into native Core Domain entities, maintaining strict separation of concerns.
1. SQL View Script & BaseView Model
To map an SQL View in AUA, define the view entity inheriting from BaseView and build a corresponding View DTO with IMapFrom.
// 1. Entity mapped to SQL View
public class UserRolesVw : BaseView
{
public long UserId { get; set; }
public string UserName { get; set; }
public string Title { get; set; }
}
// 2. DTO for View Result Handling
public class UserRolesVwDto : IMapFrom<UserRolesVw>
{
public long UserId { get; set; }
public string UserName { get; set; }
public string Title { get; set; }
}
2. View Service Interface & Implementation
// Interface
public interface IUserRolesVwService : IBaseGenericService<UserRolesVw, UserRolesVwDto>
{ }
// Service Implementation with UnitOfWork Injection
public class UserRolesVwService : BaseGenericService<UserRolesVw, UserRolesVwDto>, IUserRolesVwService
{
public UserRolesVwService(IUnitOfWork unitOfWork) : base(unitOfWork)
{ }
}
"If you think good architecture is expensive, try bad architecture."AUA Framework Philosophy