AyCode.Core/.github/copilot-instructions.md

25 lines
1.5 KiB
Markdown

# AyCode.Core — Domain Rules
> This is the **single source of truth** for domain rules. Do not duplicate these elsewhere.
> For detailed docs see: `README.md` → `docs/`
## Key Abstractions
1. **IId<T>** is the foundation interface — almost every entity implements it. Always preserve ID integrity.
2. **Generic entity hierarchy**: Interfaces (`AyCode.Interfaces`) → Entities (`AyCode.Entities`) → Models (`AyCode.Models`). Entities are abstract generics; concrete types live in consuming projects.
3. **TrackingState** enum (Added/Modified/Deleted/Unchanged) drives client-side change tracking, not EF Core.
## Serialization
4. **Toon** (Token-Oriented Object Notation) — primary goal is **LLM accuracy**. @meta/@data sections.
5. **AcBinary** — primary goal is **speed**. Two-phase scan+serialize, reference tracking, string interning.
6. **AcJson** — Newtonsoft.Json wrapper with $id/$ref, IId-based reference resolution, and chain API.
## Critical Warnings
7. **PasswordHasher** — PBKDF2-HMAC-SHA512. Do NOT modify the salt logic or iteration count — existing passwords become unverifiable.
8. **MeasuringStatus.Finnished** — intentional legacy typo in consuming projects. Do NOT fix the spelling.
9. **LogLevel enum values** — synchronized with database. Do NOT renumber.
## Conventions
10. Do not suggest removal/rollback as a solution — find a fix for the problem.
11. Extension methods over instance methods for CRUD operations (see DbSets pattern).
12. Session pattern for reads, Transaction pattern for writes (see DataLayers).