61 lines
1.7 KiB
Markdown
61 lines
1.7 KiB
Markdown
# Mango.Nop.Data
|
|
|
|
@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)"
|
|
]
|
|
}
|
|
|
|
Data access layer with repository base classes and DB context abstractions. **net9.0**.
|
|
|
|
## Documentation
|
|
|
|
| Document | Topic |
|
|
|---|---|
|
|
| `REPOSITORIES.md` | MgDbTableBase, MgDtoDbTableBase — CRUD hooks, timestamps, delete rules, event bridging |
|
|
| `TRANSACTIONS.md` | MgDbContextBase — 4 transaction methods, lock strategy, callback contract |
|
|
|
|
## Folder Structure
|
|
|
|
| Folder | Purpose |
|
|
|---|---|
|
|
| `Interfaces/` | Repository interfaces: `IMgDalBase`, `IMgDbContextBase`, `IMgDbTableBase` |
|
|
| `Repositories/` | Repository base implementations: `MgDalBase`, `MgDbContextBase`, `MgDbTableBase`, `MgDtoDbTableBase` |
|
|
|
|
## Inheritance Chains
|
|
|
|
### Repository hierarchy
|
|
```
|
|
nopCommerce EntityRepository<TEntity> (Nop.Data)
|
|
+-- MgDbTableBase<TEntity>
|
|
+-- MgDtoDbTableBase<TDtoEntity, TMainEntity>
|
|
```
|
|
|
|
### Context hierarchy
|
|
```
|
|
MgDbContextBase (abstract, implements IMgDbContextBase)
|
|
+-- [Consumer DbContexts in plugins]
|
|
```
|
|
|
|
### DAL hierarchy
|
|
```
|
|
MgDalBase<TDbContext> (implements IMgDalBase<TDbContext>)
|
|
+-- [Consumer DALs in plugins]
|
|
```
|
|
|
|
## Interfaces
|
|
|
|
| Interface | Purpose |
|
|
|---|---|
|
|
| `IMgDbTableBase` | Marker interface for repository classes |
|
|
| `IMgDbContextBase` | Contract: `Logger`, `DataProvider`, `Orders`, `Products`, 4 transaction methods |
|
|
| `IMgDalBase` | `Name` property |
|
|
| `IMgDalBase<TDbContext>` | `Context`, `MutextLock` — typed access to DB context |
|
|
|
|
## Dependencies
|
|
|
|
- `Mango.Nop.Core` (ProjectReference)
|
|
- `Nop.Core`, `Nop.Data` (nopCommerce ProjectReferences)
|
|
- `Microsoft.AspNetCore.Mvc.NewtonsoftJson`
|