Mango.Nop.Libraries/Mango.Nop.Core
Loretta 3725b4c2fd Enforce doc-first protocol, add SGen, modular plugin docs
- Enforced strict documentation-first AI agent protocol in `.github/copilot-instructions.md` (multi-repo, no auto doc edits, explicit consent, [LOADED_DOCS] prefix, [DOCUMENTATION CHECK] on code changes)
- Updated solution structure: added `docs` folder to solution items for LLM/AI context
- Integrated AyCode SGen (source-generated binary serialization) with forced runtime registration; documented SGen usage and exclusions
- Overhauled plugin `README.md` and added modular docs: `SCHEMA.md`, `DOMAIN_MODEL.md`, `MEASUREMENT.md`, `DATA_LAYER.md`, `AI_SERVICES.md`, `SIGNALR_ENDPOINTS.md`
- Updated `CLAUDE.md` to require reading copilot instructions first
- Switched appsettings connection string to production DB
- Minor doc clarifications, corrects, and project file updates
2026-04-02 22:19:29 +02:00
..
.github Enforce doc-first protocol, add SGen, modular plugin docs 2026-04-02 22:19:29 +02:00
Dtos Add serialization attributes and update to PROD config 2026-03-20 17:06:49 +01:00
Entities Add ToonDescription attributes to core entities and DTOs 2026-01-15 11:34:06 +01:00
Extensions improvements, fixes 2025-11-26 09:42:07 +01:00
Interfaces improvements, fixes 2025-11-26 09:42:07 +01:00
Loggers refactoring, cleanup, etc... 2025-10-22 15:16:20 +02:00
Models Minimal SignalR test hub and endpoint for isolated testing 2025-12-11 23:46:36 +01:00
NopDependencies Enforce doc-first protocol, add SGen, modular plugin docs 2026-04-02 22:19:29 +02:00
Services SignalR improvements; etc... 2025-10-30 14:54:33 +01:00
Utils Mango.Nop.Core cleanup; 2025-11-05 14:56:40 +01:00
docs Comprehensive documentation overhaul and expansion 2026-03-30 10:26:35 +02:00
AcBinaryForcedInit.cs Enforce doc-first protocol, add SGen, modular plugin docs 2026-04-02 22:19:29 +02:00
Mango.Nop.Core.csproj Enforce doc-first protocol, add SGen, modular plugin docs 2026-04-02 22:19:29 +02:00
NopCommonConst.cs temp 2025-09-02 15:21:57 +02:00
README.md Enforce doc-first protocol, add SGen, modular plugin docs 2026-04-02 22:19:29 +02:00

README.md

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<TOrderItemDto, TProductDto>
        +-- MgOrderItemDto<TProductDto>
        +-- MgProductDto
        +-- MgStockQuantityHistoryDto<TProductDto>
        +-- MgStockTaking<TStockTakingItem>
        +-- MgStockTakingItem<TStockTaking, TProduct>

Key Types (not in docs/)

Entities

Type Key features
MgEntityBase Inherits BaseEntity, implements IEntityInt. ToString() -> "{TypeName}; Id: {Id}"
MgStockTaking<TStockTakingItem> StartDateTime, IsClosed, List<TStockTakingItem> navigation. Implements ITimeStampInfo
MgStockTakingItem<TStockTaking, TProduct> 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/docs/LOGGING.md.

Type Inherits Purpose
ILogger IAcLoggerBase Mango-level logger interface
ILogger<TCategory> ILogger Generic category logger interface
Logger AcLoggerBase Logger implementation with IAcLogWriterBase[] writers
Logger<TCategory> 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<T>), string utilities

Dependencies

  • linq2db — data access, [Association] / [Table] attributes
  • Microsoft.AspNetCore.Mvc.NewtonsoftJson — JSON serialization
  • Binary serialization: AcBinarySerializer (see AyCode.Core/docs/BINARY_FORMAT.md). SignalR transport: AcSignalR (see AyCode.Core/AyCode.Services/docs/SIGNALR.md).
  • AyCode.Core.Serializers.SourceGenerator (ProjectReference, OutputItemType="Analyzer") — compile-time binary serializer. See 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.

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.