# Mango.Nop.Core @project { type = "framework" own-dep-projects = [ "AyCode.Core, AyCode.Core.Server, AyCode.Entities, AyCode.Entities.Server, AyCode.Interfaces, AyCode.Interfaces.Server, AyCode.Utils (in AyCode.Core repo)" ] } Shared domain library containing entities, DTOs, interfaces, and nopCommerce entity mirrors. **net9.0**. Zero nopCommerce runtime dependency. ## Documentation | Document | Topic | |---|---| | `DTOS.md` | DTO system — two mapping strategies, all DTO types, GenericAttribute typed access | | `NOP_DEPENDENCIES.md` | NopDependencies pattern — mirror copies, namespace rules, file list | ## Folder Structure | Folder | Purpose | |---|---| | `Dtos/` | DTO classes shared across consumers | | `Entities/` | Custom domain entities | | `Extensions/` | Extension methods for `BaseEntity` collections and `GenericAttribute` | | `Interfaces/` | DTO interfaces, soft-delete, foreign key markers | | `Loggers/` | `ILogger` / `Logger` — logging abstraction wrapping AyCode logger | | `Models/` | Login request/response models | | `NopDependencies/` | Mirror copies of nopCommerce entity classes (same namespaces as originals) | | `Services/` | `IMgLockService` interface | | `Utils/` | `CommonHelper2` — email validation, type conversion utilities | ## Entity Hierarchy ``` Nop.Core.BaseEntity (NopDependencies/, implements IBaseEntity) +-- MgEntityBase (Entities/, implements IEntityInt from AyCode) +-- MgOrderDto +-- MgOrderItemDto +-- MgProductDto +-- MgStockQuantityHistoryDto +-- MgStockTaking +-- MgStockTakingItem ``` ## Key Types (not in docs/) ### Entities | Type | Key features | |---|---| | `MgEntityBase` | Inherits `BaseEntity`, implements `IEntityInt`. `ToString()` -> `"{TypeName}; Id: {Id}"` | | `MgStockTaking` | `StartDateTime`, `IsClosed`, `List` navigation. Implements `ITimeStampInfo` | | `MgStockTakingItem` | `StockTakingId`, `ProductId`, `IsMeasured`, stock quantities. Navigations to parent and product | ### Extensions | Method | Purpose | |---|---| | `UpdateBaseEntityCollection` | Add/update/remove entities in a list by Id match | ### Loggers Extends AyCode logging infrastructure — for base types see `AyCode.Core/AyCode.Core/docs/LOGGING/README.md`. | Type | Inherits | Purpose | |---|---|---| | `ILogger` | `IAcLoggerBase` | Mango-level logger interface | | `ILogger` | `ILogger` | Generic category logger interface | | `Logger` | `AcLoggerBase` | Logger implementation with `IAcLogWriterBase[]` writers | | `Logger` | `Logger` | Typed logger — category name from `typeof(TCategory).Name` | ### Models | Type | Purpose | |---|---| | `MgLoginModelRequest` | `Email` + `Password` for SignalR/API login | | `MgLoginModelResponse` | `CustomerDto?` + `ErrorMessage`. Computed `IsSuccesLogin` | ### Other | Type | Purpose | |---|---| | `NopCommonConst` | Abstract const class inheriting `AcConst` (placeholder) | | `CommonHelper2` | Email validation, IP validation, type conversion (`To`), string utilities | ## Dependencies - `linq2db` — data access, `[Association]` / `[Table]` attributes - `Microsoft.AspNetCore.Mvc.NewtonsoftJson` — JSON serialization - Binary serialization: `AcBinarySerializer` (see `AyCode.Core/AyCode.Core/docs/BINARY/BINARY_FORMAT.md`). SignalR transport: `AcSignalR` (see `AyCode.Core/AyCode.Services/docs/SIGNALR/README.md`). - `AyCode.Core.Serializers.SourceGenerator` (ProjectReference, `OutputItemType="Analyzer"`) — compile-time binary serializer. See [`AyCode.Core/docs/BINARY_SOURCE_GEN.md`](../../../../../../Aycode/Source/AyCode.Core/AyCode.Core/docs/BINARY_SOURCE_GEN.md) - AyCode DLL references: `AyCode.Interfaces`, `AyCode.Core`, `AyCode.Utils`, `AyCode.Entities` (types only, no runtime nopCommerce dependency) ## AcBinary Source Generator (SGen) 9 types annotated with `[AcBinarySerializable]`. For general SGen docs see [`AyCode.Core/docs/BINARY_SOURCE_GEN.md`](../../../../../../Aycode/Source/AyCode.Core/AyCode.Core/docs/BINARY_SOURCE_GEN.md). Requires `InternalsVisibleTo("Mango.Nop.Core")` in `AyCode.Core/Properties/AssemblyInfo.cs`. ### Excluded types | Type | Reason | |---|---| | `DiscountProductMapping` | Base `DiscountMapping` hides `BaseEntity.Id` with readonly `new int Id { get; }` → CS0200. Uses compiled-expression fallback. |