1.6 KiB
1.6 KiB
Conventions
Naming
Mgprefix for all custom types:MgEntityBase,MgOrderDto,MgDbTableBase,MgDalBase, etc.I+ name for interfaces:IMgDalBase,IMgDbTableBase,IMgOrderDto,IMgLockService.Dtosuffix for DTOs wrapping nopCommerce entities:MgOrderDto,MgProductDto,MgOrderItemDto.DbTablesuffix for repository classes:MgDbTableBase,MgDtoDbTableBase.Basesuffix for abstract base classes:MgEntityBase,ModelDtoBase,MgBackgroundServiceBase.
Patterns
- DTO bidirectional mapping —
ModelDtoBase<TMainEntity>providesCopyEntityValuesToDto(entity)andCreateMainEntity(). Override both in concrete DTOs. - NopDependencies mirror — entity classes in
NopDependencies/use the same namespace as the original nopCommerce types. Do not change namespaces. - GenericAttribute typed access — use
GenericAttributeExtensions.GetValueOrDefault<T>()/GetValueOrNull<T>()instead of raw string parsing. - Repository base chain —
MgDbTableBase<TEntity>→EntityRepository<TEntity>(nopCommerce). Override virtual methods, don't replace the chain. - Timestamp interfaces — entities implementing
ITimeStampCreated/ITimeStampUpdatedget automatic timestamp management inMgDbTableBase.
Project Boundaries
Mango.Nop.Core— NO nopCommerce runtime dependency. Only NopDependencies mirrors.Mango.Nop.Data— depends on nopCommerce data layer (Nop.Core,Nop.Data).Mango.Nop.Services— depends on full nopCommerce stack (includesNop.Services,Nop.Web.Framework).