# Conventions ## Naming - **`Mg` prefix** for all custom types: `MgEntityBase`, `MgOrderDto`, `MgDbTableBase`, `MgDalBase`, etc. - **`I` + name** for interfaces: `IMgDalBase`, `IMgDbTableBase`, `IMgOrderDto`, `IMgLockService`. - **`Dto` suffix** for DTOs wrapping nopCommerce entities: `MgOrderDto`, `MgProductDto`, `MgOrderItemDto`. - **`DbTable` suffix** for repository classes: `MgDbTableBase`, `MgDtoDbTableBase`. - **`Base` suffix** for abstract base classes: `MgEntityBase`, `ModelDtoBase`, `MgBackgroundServiceBase`. ## Patterns - **DTO bidirectional mapping** — `ModelDtoBase` provides `CopyEntityValuesToDto(entity)` and `CreateMainEntity()`. Override both in concrete DTOs. - **NopDependencies mirror** — entity classes in `NopDependencies/` use the **same namespace** as the original nopCommerce types. Do not change namespaces. - **GenericAttribute typed access** — use `GenericAttributeExtensions.GetValueOrDefault()` / `GetValueOrNull()` instead of raw string parsing. - **Repository base chain** — `MgDbTableBase` → `EntityRepository` (nopCommerce). Override virtual methods, don't replace the chain. - **Timestamp interfaces** — entities implementing `ITimeStampCreated` / `ITimeStampUpdated` get automatic timestamp management in `MgDbTableBase`. ## Project Boundaries - `Mango.Nop.Core` — NO nopCommerce runtime dependency. Only NopDependencies mirrors. - `Mango.Nop.Data` — depends on nopCommerce data layer (`Nop.Core`, `Nop.Data`). - `Mango.Nop.Services` — depends on full nopCommerce stack (includes `Nop.Services`, `Nop.Web.Framework`).