5.9 KiB
5.9 KiB
Glossary
Terminology for the Mango.Nop Libraries. Read this before working on unfamiliar areas.
Entity & DTO System
| Term | Definition |
|---|---|
| BaseEntity | nopCommerce root entity base with int Id. Mirror copy in NopDependencies/. Namespace: Nop.Core. |
| IBaseEntity | Interface for BaseEntity (defined alongside it in NopDependencies). Only int Id. |
| MgEntityBase | Custom entity base — inherits BaseEntity, implements IEntityInt (AyCode). ToString() → "{TypeName}; Id: {Id}". |
| ModelDtoBase | Non-generic DTO base — only int Id. Implements IModelDtoBase. |
| ModelDtoBase<T> | Generic DTO base with bidirectional mapping: CopyEntityValuesToDto() reads from entity, CopyDtoValuesToEntity() writes to entity, CreateMainEntity() creates entity from DTO. Uses Activator.CreateInstance<T>(). |
| IModelDtoBase | IEntityInt + IModelDtoBaseEmpty. Marker for all DTOs with int Id. |
| IModelDtoBase<T> | Contract: CreateMainEntity(), CopyDtoValuesToEntity(), CopyEntityValuesToDto(). |
| NopDependencies | Mirror copies of nopCommerce entity classes in Mango.Nop.Core. Same namespaces as originals. Eliminates full nopCommerce dependency for consumers that only need types. |
| GenericAttribute | nopCommerce polymorphic key-value store. KeyGroup = owner type name, EntityId = owner ID, Key = attribute name, Value = string value. CreatedOrUpdatedDateUTC tracks last change. |
| PropertyHelper.CopyPublicValueTypeProperties | AyCode utility — reflection-based copy of all public value-type properties between two objects. Used by complex DTOs (MgOrderDto, MgOrderItemDto). |
| ToonDescription | AyCode metadata attribute for AI/doc tooling. Properties: Purpose, BusinessRule, TypeRelation, RelatedTypes. |
| AcBinarySerializable | AyCode binary serialization attribute (AcBinarySerializer, see AyCode.Core/AyCode.Core/docs/BINARY/BINARY_FORMAT.md). Configures how a type is serialized for AcSignalR transport (see AyCode.Core/AyCode.Services/docs/SIGNALR/README.md). |
Data Access
| Term | Definition |
|---|---|
| MgDbTableBase<T> | Repository base wrapping nopCommerce EntityRepository<T>. Adds GetAll() (IQueryable<T>), automatic timestamp management via ITimeStampCreated/ITimeStampModified interfaces, CRUD hooks (OnInsert, OnUpdate, OnDelete). |
| MgDtoDbTableBase<TDto, TMain> | DTO-aware repository. Delete operations throw — must use DeleteMainEntityById(). Bridges DTO events → main entity events (EntityInsertedEvent, EntityUpdatedEvent). |
| MgDbContextBase | Database context base. Exposes IRepository<Order>, IRepository<OrderItem>, IRepository<Product>, INopDataProvider. Provides 4 transaction methods (Transaction, TransactionSafe, TransactionAsync, TransactionSafeAsync). |
| MgDalBase<T> | Data Access Layer orchestrator — Name, Context (typed TDbContext), MutextLock (cross-process Mutex). |
| TransactionSafe | Transaction with global SemaphoreSlim lock. Prevents concurrent modifications. Use for order creation, stock changes. |
| EntityRepository<T> | nopCommerce built-in repository base (Nop.Data). MgDbTableBase extends this. |
| INopDataProvider | nopCommerce interface for raw LinqToDB data access. Used by MgDbContextBase and MgDtoDbTableBase. |
Services
| Term | Definition |
|---|---|
| MgBackgroundServiceBase | Base for hosted background services. Loop: Task.Delay(interval) → OnExecuteAsync(). Supports pause. Per-iteration exception handling. Uses nopCommerce ILogger. |
| MgSessionServiceBase<T> | In-memory session management via ConcurrentDictionary<string, T>. Thread-safe. Methods: GetOrCreateSessionItem, TryAddSessionItem, TryGetSessionItem, TryRemoveSessionItem, TryGetSessionItemBySignlaRConnectionId. |
| MgSessionItemBase | Session item with SessionId, SignaRConnectionId, RequestCount. Primary constructor: (string sessionKey). |
| MgEventConsumerBase | nopCommerce event consumer base. Subscribes to: EntityUpdatedEvent<Product>, EntityInsertedEvent<Product>, CustomerRegisteredEvent, OrderPlacedEvent, PageRenderingEvent, ProductSearchEvent. All handlers virtual with empty default. |
| MgLockServiceBase | SemaphoreSlim(1) wrapper. Implements IMgLockService. Used by MgDbContextBase.TransactionSafe*. |
| NopLogWriter | Bridges AyCode logging (see AyCode.Core/AyCode.Core/docs/LOGGING/README.md) to nopCommerce Log table. |
| NopLoggerMsSqlNopDataProvider | Extends MsSqlNopDataProvider. Provides InsertLogItem<T>() / InsertLogItemAsync<T>() with own TransactionScope(Suppress, ReadUncommitted) to avoid transaction nesting. |
AyCode Types (external, from DLL references)
| Term | Definition |
|---|---|
| IEntityInt | int Id entity contract (AyCode.Interfaces.Entities) |
| IAcLoggerBase | Logger interface — see AyCode.Core/AyCode.Core/docs/LOGGING/README.md (AyCode.Core.Loggers) |
| IAcLogWriterBase | Log writer interface — pluggable output sink (see AyCode.Core/AyCode.Core/docs/LOGGING/README.md) |
| AcLoggerBase | Logger base class with category name and writer array (see AyCode.Core/AyCode.Core/docs/LOGGING/README.md) |
| AcLogItemWriterBase<T> | Log writer base for structured log items (see AyCode.Core/AyCode.Core/docs/LOGGING/README.md) |
| IAcModelDtoBaseEmpty | Empty DTO marker interface |
| IAcSoftRemoveEntity | Soft-delete contract (AyCode) |
| IForeignKey | FK marker interface |
| IForeignCollection<T> | FK collection marker |
| ITimeStampCreated | Created datetime property |
| ITimeStampModified | Modified datetime property |
| ITimeStampInfo | Combines Creator (int), Created, Modified |
| AcConst | Abstract constants base class |
| TaskHelper.ToThreadPoolTask | Wraps Func<Task<T>> into Task.Run on thread pool |