Mango.Nop.Libraries/Mango.Nop.Core/README.md

42 lines
2.1 KiB
Markdown

# Mango.Nop.Core
Shared domain library containing entities, DTOs, interfaces, and nopCommerce entity mirrors. **net9.0**.
## Folder Structure
| Folder | Purpose |
|---|---|
| `Dtos/` | DTO classes shared across consumers: `MgOrderDto`, `MgOrderItemDto`, `MgProductDto`, `MgGenericAttributeDto`, `MgStockQuantityHistoryDto`, `CustomerDto`, `ModelDtoBase` |
| `Entities/` | Custom entities: `MgEntityBase`, `MgStockTaking`, `MgStockTakingItem` |
| `Extensions/` | Extension methods for nopCommerce `BaseEntity` collections and `GenericAttribute` |
| `Interfaces/` | DTO interfaces (`IMgOrderDto`, `IMgProductDto`, etc.), soft-delete interfaces, foreign key markers |
| `Loggers/` | `ILogger` / `Logger` — logging abstraction |
| `Models/` | Login request/response models (`MgLoginModelRequest`, `MgLoginModelResponse`) |
| `NopDependencies/` | Mirror copies of nopCommerce entity classes — `BaseEntity`, `Customer`, `Order`, `OrderItem`, `Product`, `GenericAttribute`, enums (`OrderStatus`, `PaymentStatus`, etc.) |
| `Services/` | `IMgLockService` interface |
| `Utils/` | `CommonHelper2` — utility methods |
## Key Types
### DTOs (Dtos/)
- **`MgOrderDto`** — Order DTO used across SignalR communication
- **`MgOrderItemDto`** — Order item DTO
- **`MgProductDto`** — Product DTO with GenericAttribute-based properties
- **`MgGenericAttributeDto`** — GenericAttribute DTO
- **`ModelDtoBase`** / `IModelDtoBase` — base class for all DTOs
### nopCommerce Mirrors (NopDependencies/)
Mirror copies of nopCommerce entities so that `Mango.Nop.Core` can be referenced without pulling in the full nopCommerce dependency chain. Includes:
- `BaseEntity` — root entity base
- `Customer`, `CustomerRole`, `Order`, `OrderItem`, `Product`, `GenericAttribute`, `StockQuantityHistory`
- Enums: `OrderStatus`, `PaymentStatus`, `ShippingStatus`, `ProductType`, etc.
### Entities (Entities/)
- **`MgEntityBase`** — base for all custom Mango entities
- **`MgStockTaking`**, **`MgStockTakingItem`** — stocktaking entities
## Dependencies
- `linq2db` — data access
- `MessagePack` — binary serialization
- `Microsoft.AspNetCore.Mvc.NewtonsoftJson` — JSON serialization