How kathulhur/store-management-system works
Main Components
• Presentation Layer: Represented by the StoreManagementSystemX project. This layer houses the WPF Views (XAML files), code-behind (e.g., MainWindow.xaml.cs), and ViewModels (e.g., DashboardViewModel, LoginViewModel, and the view model folders for Products, StockPurchases, Transactions, and Users). Also include the Services defined in the UI project (authentication, barcode generation, dialog services, etc.) and note the MVVM (Model-View-ViewModel) pattern used.
• Domain Layer: Found in the StoreManagementX.Domain project. This layer contains domain aggregates (Products, StockPurchases, Transactions, Users), factories, repositories, and domain services (including barcode service interfaces) that encapsulate the core business logic.
• Infrastructure Layer: The StoreManagementSystemX.Infrastructure project acts as the bridge between the domain and the database. It includes DTOs, persistence implementations (repository implementations like ProductRepositoryImpl, StockPurchaseRepositoryImpl, etc.), migrations, and connection context classes. This layer uses Entity Framework Core for ORM tasks.
• Database Layer: The StoreManagementSystemX.Database project contains the EF Core DbContext, repository interfaces and implementations for database access, migrations, and the actual SQLite database file (sqlite.db). It is responsible for setting up the database and performing CRUD operations.
Relationships & Interactions
• UI/Presentation layer communicates with the Domain and Infrastructure layers via service calls. For example, user interactions in a WPF window (login, product management, transaction processing) will trigger calls to the authentication, product creation, and transaction services.
• Services in the Presentation layer might directly invoke Domain layer functions or use the Infrastructure layer to persist data.
• The Domain layer exposes domain logic through repositories, factories, and aggregate operations. Its repositories may be implemented by the Infrastructure or Database projects.
• The Infrastructure layer (with its DTOs and EF Core configurations) forms the intermediary, ensuring that the high-level domain models are properly persisted in the SQLite database.
Architectural Patterns & Design Principles
• MVVM Pattern: Clearly used in the WPF project, so ensure that Views, ViewModels, and Models are visually distinct.
• Separation of Concerns: Different projects for Domain, Infrastructure, and Database show clear boundaries between business logic, data persistence, and presentation.
• Repository and Unit of Work Pattern: These are evident from the repository interfaces and implementations in both the Domain and Database projects.
• Clean Architecture: Maintain a separation between high-level business rules (Domain) and low-level data access (Infrastructure/Database).
Relevant Technologies and Frameworks
• C# and .NET Core as primary language and runtime.
• WPF for creating the user interface.
• Entity Framework Core for ORM.
• SQLite is the choice for data storage.
• Testing frameworks are used in projects like StoreManagementSystemX.Domain.Tests and StoreManagementSystemX.Tests.