Mango.Nop.Libraries/Mango.Nop.Core/docs/ARCHITECTURE.md

45 lines
2.2 KiB
Markdown

# Architecture
## Framework vs. Consumer Boundary
This solution is **Layer 2 — Domain framework** (NopCommerce-plugin base). Built on Layer 0 (AyCode.Core), consumed by Layer 3 (specific plugin apps, plural and unknown). Full doctrine: AyCode.Core's `docs/ARCHITECTURE.md#framework-vs-consumer-boundary`.
### Layer position
```
Layer 0 — AyCode.Core universal primitives (serializers, logging, entities)
Layer 2 — Mango.Nop.Core this solution — NopCommerce-plugin domain framework
Layer 3 — Consumer plugin apps specific plugin projects with business logic
```
### Nop-plugin-framework-specific notes
- **`NopDependencies/`** mirrors NopCommerce entity classes under the original Nop namespaces — no runtime Nop dependency, compile-time type parity only
- **DTOs** use type parameters for consumer entity types (e.g. `MgOrderDto<TOrderItemDto, TProductDto>`) — concrete types are provided by plugin projects
- **Entity hierarchy**: `Nop.Core.BaseEntity` (mirrored) → `MgEntityBase` → generic DTOs/entities parameterized for consumers
- **`Logger` / `ILogger`** extend AyCode logging (`AcLoggerBase`) — plugin projects may subclass again if business-specific writers are needed
- **Zero runtime Nop dependency** — plugin apps bring their own Nop runtime
### What belongs here vs. in a plugin
**Yes, framework:**
- NopCommerce entity mirrors (for cross-plugin type sharing)
- Generic DTOs with type parameters
- Shared interfaces and extensions for NopCommerce domain entities
- Logger base with AyCode integration
**No, plugin only:**
- Plugin-specific business logic
- Plugin-named types (`XxxPlugin`, `XxxService` where Xxx is a specific product)
- Hardcoded plugin configuration, tenant, or product IDs
## Related Documents
| Topic | Document |
|---|---|
| Framework-first doctrine (full) | `../../../../../../../Aycode/Source/AyCode.Core/docs/ARCHITECTURE.md#framework-vs-consumer-boundary` |
| Placement rules, anti-patterns | `CONVENTIONS.md#framework-first-placement` |
| DTO system and GenericAttribute typed access | `DTOS.md` |
| NopDependencies mirror pattern | `NOP_DEPENDENCIES.md` |
| Folder structure and key types index | `../README.md` |