All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 26s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s
44 lines
1.5 KiB
Markdown
44 lines
1.5 KiB
Markdown
# ENTITY LAYER KNOWLEDGE BASE
|
|
|
|
**Generated:** 2026-01-28
|
|
**Parent:** EmailBill/AGENTS.md
|
|
|
|
## OVERVIEW
|
|
Database entities using FreeSql ORM with BaseEntity inheritance pattern.
|
|
|
|
## STRUCTURE
|
|
```
|
|
Entity/
|
|
├── BaseEntity.cs # Base entity with Snowflake ID
|
|
├── GlobalUsings.cs # Common imports
|
|
├── BudgetRecord.cs # Budget tracking entity
|
|
├── TransactionRecord.cs # Transaction entity
|
|
├── EmailMessage.cs # Email processing entity
|
|
└── MessageRecord.cs # Message entity
|
|
```
|
|
|
|
## WHERE TO LOOK
|
|
| Task | Location | Notes |
|
|
|------|----------|-------|
|
|
| Base entity pattern | BaseEntity.cs | Snowflake ID, audit fields |
|
|
| Budget entities | BudgetRecord.cs, BudgetArchive.cs | Budget tracking |
|
|
| Transaction entities | TransactionRecord.cs, TransactionPeriodic.cs | Financial transactions |
|
|
| Email entities | EmailMessage.cs, MessageRecord.cs | Email processing |
|
|
|
|
## CONVENTIONS
|
|
- Inherit from BaseEntity for all entities
|
|
- Use [Column] attributes for FreeSql mapping
|
|
- Snowflake IDs via YitIdHelper.NextId()
|
|
- Chinese comments for business logic
|
|
- XML docs for public APIs
|
|
|
|
## ANTI-PATTERNS (THIS LAYER)
|
|
- Never use DateTime.Now (use IDateTimeProvider)
|
|
- Don't skip BaseEntity inheritance
|
|
- Avoid complex business logic in entities
|
|
- No database queries in entity classes
|
|
|
|
## UNIQUE STYLES
|
|
- Fluent Chinese naming for business concepts
|
|
- Audit fields (CreateTime, UpdateTime) automatic
|
|
- Soft delete patterns via UpdateTime nullability |