How habibor-rahaman1010/asp-net-batch-10 works
1. Overall shape
This is a layered ASP.NET Core solution built around an inventory domain. The solution is split into four main runtime projects: a web UI, an application-services layer, a domain model, and an infrastructure layer, plus a separate worker service and a test project.
2. Presentation boundary: DevSkill.Inventory.Web
The web project is the user-facing host. It uses ASP.NET Core MVC with Areas, especially an Admin area for inventory maintenance screens. It contains controllers, Razor views, partials, view models, and static assets from AdminLTE/Bootstrap/jQuery. This is the primary entry point for human users.
3. Web module responsibilities
The web layer owns request handling, form/view models, AutoMapper profiles, and UI composition. Controllers such as ProductController, CategoryController, BrandController, StockAdjustmentController, and DashboardController map user actions to application services. AccountController handles authentication-related flows like login, registration, and email confirmation.
4. Application layer: orchestration and business use cases
DevSkill.Inventory.Application contains the management services for each business capability: products, categories, subcategories, brands, units, taxes, locations, warranties, product types, barcode types, adjustment types, and stock adjustments. These services are the main orchestration boundary between UI and persistence and are exposed through matching service contracts.
5. Domain model: core business concepts
DevSkill.Inventory.Domain defines the inventory language of the system: entities such as Product, Brand, Category, StockAdjustment, BusinessLocation, Unit, Warranty, and tax-related types. It also holds DTOs for product search/listing, enums like ProductStatus and AllowDecimal, and shared abstractions such as repository contracts, unit-of-work contracts, and utility interfaces.
6. Infrastructure layer: persistence and concrete services
DevSkill.Inventory.Infrastructure provides the implementations for domain abstractions. It includes repository classes, unit-of-work implementations, EF Core DbContexts, application time abstraction, email utility, SQL utility, Razor utility, TempData helpers, and the concrete inventory identity classes. This is the bridge from the pure domain/application layers to actual runtime dependencies.
7. Data storage boundary
There are two distinct database contexts: ApplicationDbContext for identity/authentication data and InventoryDbContext for inventory business data. The web project carries EF Core migrations for both contexts, indicating that the web host is responsible for creating and evolving the databases during deployment.
8. Identity and authorization
Authentication is implemented with custom ASP.NET Core Identity types in the infrastructure project: users, roles, claims, logins, tokens, managers, and a custom AgeRequirement. This suggests authorization is not just role-based; it also includes policy/requirement-based access control. The account views and admin user-management screens depend on this identity subsystem.
9. Inventory feature flow
The common flow for business features is: browser request → MVC controller/view model → application management service → repository/unit-of-work abstraction → EF Core context → database. The admin screens are CRUD-heavy and centered on catalog/master-data management, with stock adjustment and product maintenance as the more transaction-oriented parts of the domain.
10. Worker process
DevSkill.Inventory.WorkerService is a separate .NET worker host with its own Program, Worker, and module registration. The tree does not show what jobs it runs, but architecturally it is a background execution boundary separate from the web UI, likely intended for scheduled or asynchronous processing using the same solution conventions.
11. Cross-cutting concerns
Email sending, current time abstraction, SQL helpers, and TempData helpers are separated into reusable services rather than being embedded in controllers. This indicates an attempt to keep business/application logic testable and to isolate external concerns from the domain.
12. Testing strategy
The test project focuses on application-service tests for products, categories, brands, business locations, product types, and stock adjustments. That implies the critical logic is expected to live in the application layer, with tests validating orchestration and business rules there rather than in the web layer.
Main entry points: ProductManagementService.cs Mgmt services · IRepositoryBase.cs Contracts · ProductController.cs Admin area · Program.cs Web host
Components 19
Web UI
ASP.NET Core MVC host and admin presentation layer
- Web host · Main user-facing entry point for MVC and areas
DevSlkill.Inventory/DevSkill.Inventory.Web/Program.cs - Admin area · Back-office screens for inventory maintenance and identity admin
DevSlkill.Inventory/DevSkill.Inventory.Web/Areas/Admin/Controllers/ProductController.cs - Account UI · Login, registration, email confirmation, and access denied flows
DevSlkill.Inventory/DevSkill.Inventory.Web/Controllers/Account/AccountController.cs - View models · Presentation-specific create, list, update, and auth models
DevSlkill.Inventory/DevSkill.Inventory.Web/Areas/Admin/Models/ProductCreateModel.cs - Mapping · Maps domain and service shapes to web view models
DevSlkill.Inventory/DevSkill.Inventory.Web/AutoMapProfile/WebProfile.cs
Application
Use-case orchestration and management services
- Mgmt services · Orchestrates inventory use cases across master data and stock flows
DevSlkill.Inventory/DevSkill.Inventory.Application/Services/ProductManagementService.cs - Service contracts · Application-layer boundaries consumed by controllers and tests
DevSlkill.Inventory/DevSkill.Inventory.Application/ServicesContract/IProductManagementService.cs
Domain
Core inventory model and shared contracts
- Entities · Inventory aggregates and core business concepts
DevSlkill.Inventory/DevSkill.Inventory.Domain/Entities/Product.cs - DTOs · Product search and listing data transfer shapes
DevSlkill.Inventory/DevSkill.Inventory.Domain/Dtos/ProductDto.cs - Contracts · Repository, unit-of-work, time, email, and SQL abstractions
DevSlkill.Inventory/DevSkill.Inventory.Domain/RepositoryContracts/IRepositoryBase.cs - Enums · Shared domain state such as product status and decimal rules
DevSlkill.Inventory/DevSkill.Inventory.Domain/Enums/ProductStatus.cs
Infrastructure
Persistence, identity, and concrete integrations
- Repositories · Concrete persistence adapters for inventory aggregates
DevSlkill.Inventory/DevSkill.Inventory.Infrastructure/Repositories/ProductRepository.cs - Unit of work · Coordinates repository commits for inventory persistence
DevSlkill.Inventory/DevSkill.Inventory.Infrastructure/UnitOfWork/InventoryUnitOfWork.cs - Identity · Custom user, role, manager, and authorization requirement types
DevSlkill.Inventory/DevSkill.Inventory.Infrastructure/InventoryIdentity/ApplicationUser.cs - Db contexts · Application and inventory database contexts
DevSlkill.Inventory/DevSkill.Inventory.Infrastructure/Data/InventoryDbContext.cs - Utilities · Email, time, Razor, SQL, and TempData helpers
DevSlkill.Inventory/DevSkill.Inventory.Infrastructure/EmailUtility.cs
Worker
Background execution host
- Worker host · Separate .NET worker process for asynchronous jobs
DevSlkill.Inventory/DevSkill.Inventory.WorkerService/Program.cs - Worker module · Worker-specific dependency registration and wiring
DevSlkill.Inventory/DevSkill.Inventory.WorkerService/WorkerModules/WorkerModule.cs
Tests
Application-service test suite
- App tests · Validates application-service orchestration and business rules
tests/DevSkill.Inventory.Application.Tests/ProductManagementServiceTests.cs
Connections 25
- Web host → Admin area: hosts · ASP.NET Core MVC serves the admin area and UI routes
- Web host → Account UI: hosts · Main web host serves account and public pages
- Admin area → View models: binds · Controllers use presentation models for requests and responses
- Admin area → Service contracts: calls · Admin controllers depend on application service interfaces
- Account UI → Identity: auth · Authentication and authorization flow through the identity subsystem
- Mapping → Entities: maps · Web mapping profiles translate domain shapes to UI models
- Mapping → View models: maps · Profiles populate form and list models for views
- Mgmt services → Service contracts: implements · Concrete management services fulfill application contracts
- Mgmt services → Contracts: uses · Services coordinate through repository and unit-of-work abstractions
- Mgmt services → Entities: operates · Business logic centers on inventory entities
- Mgmt services → DTOs: returns · Query and listing operations produce DTOs
- Repositories → Contracts: implements · Repositories satisfy the domain repository interfaces
- Repositories → Entities: persists · Repositories load and store inventory entities
- Unit of work → Contracts: implements · Unit-of-work classes realize domain transaction contracts
- Unit of work → Db contexts: wraps · Unit of work coordinates EF Core database contexts
- Identity → Db contexts: stores · Identity types are backed by the application database context
- Utilities → Contracts: implements · Utilities provide concrete email, time, SQL, and Razor services
- Worker host → Worker module: loads · Worker startup wires services through module registration
- Worker host → Utilities: uses · Background jobs reuse shared utility services
- App tests → Mgmt services: verifies · Tests focus on management-service behavior and orchestration
- App tests → Contracts: mocks · Application tests likely substitute repository abstractions
- Web host → Mgmt services: depends · Web startup resolves application services for controllers
- Mgmt services → Repositories: runs on · Application workflows are backed by repository implementations
- Account UI → View models: binds · Account forms use dedicated signin and registration models
- Admin area → Identity: manages · Admin user-management screens depend on custom identity types