How eimarramos/doppio works
Main Components
• UI Layer:
– Contains all the XAML pages, view models, and platform-specific implementations (Android, iOS, Windows, etc.).
– Handles presentation logic, user interaction, and navigation.
• Application Layer:
– Houses various service classes (CartService, CategoryService, CoffeeService, ShopService) and the dependency injection configuration.
– Responsible for orchestrating business logic and acting as a mediator between the UI and Domain layers.
• Domain Layer:
– Contains all the domain models (Cart, CartDetail, Category, Coffee, Notify, Shop) along with repository interface definitions (for Cart, Category, Coffee, Shop).
– Represents the core business logic and rules.
• Infrastructure Layer:
– Implements the repository classes for various domain entities through API-based data access.
– Contains persistence components (e.g., DatabaseContext, Initialiser, interceptors) and common utilities (such as base entities and mapping profiles).
– Handles external concerns like data storage, caching, and integration with external APIs.
Relationships and Data Flow
• The UI layer (views and view models) communicates with the Application layer’s services to perform business operations.
• The Application layer uses its dependency injection configuration to work with the Domain layer’s repository interfaces.
• The Infrastructure layer provides the actual implementations for these repositories and manages database actions through the DatabaseContext and persistence classes.
• Data flows from the UI to the Application layer, then to the Domain—which encapsulates business rules—and finally the Infrastructure layer handles data persistence.
• Additionally, mapping profiles and interceptors in the Infrastructure assist in transforming domain entities to infrastructure-specific representations and enforcing rules (e.g., CartTotalInterceptor).
Architectural Patterns and Design Principles
• Emphasis on separation of concerns: Each layer (UI, Application, Domain, Infrastructure) has a distinct responsibility.
• Use of the Repository Pattern: Domain interfaces are defined in the Domain layer, while their implementations reside in the Infrastructure layer.
• Dependency Injection: Centralized in the ApplicationLayer and Infrastructure projects, ensuring inversion of control.
• Cross-platform UI via .NET MAUI: Indicates a strong focus on modular design and platform abstraction for the UI components.
– UI → Application Services (for invoking business operations)
– Application Services → Domain (for business rules)
– Domain → Infrastructure (for repository calls and persistence)