2.3 KiB
2.3 KiB
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
- IId is the foundation interface — almost every entity implements it. Always preserve ID integrity.
- Generic entity hierarchy: Interfaces (
AyCode.Interfaces) → Entities (AyCode.Entities) → Models (AyCode.Models). Entities are abstract generics; concrete types live in consuming projects. - TrackingState enum (Added/Modified/Deleted/Unchanged) drives client-side change tracking, not EF Core.
Serialization
- Toon (Token-Oriented Object Notation) — primary goal is LLM accuracy. @meta/@data sections.
- AcBinary — primary goal is speed. Two-phase scan+serialize, reference tracking, string interning.
- AcJson — Newtonsoft.Json wrapper with $id/$ref, IId-based reference resolution, and chain API.
Critical Warnings
- PasswordHasher — PBKDF2-HMAC-SHA512. Do NOT modify the salt logic or iteration count — existing passwords become unverifiable.
- MeasuringStatus.Finnished — intentional legacy typo in consuming projects. Do NOT fix the spelling.
- LogLevel enum values — synchronized with database. Do NOT renumber.
Conventions
- Do not suggest removal/rollback as a solution — find a fix for the problem.
- Extension methods over instance methods for CRUD operations (see DbSets pattern).
- Session pattern for reads, Transaction pattern for writes (see DataLayers).
- Target framework is net9.0 (set in AyCode.Core.targets). The SourceGenerator targets netstandard2.0. Consuming projects (AyCode.Blazor, FruitBankHybridApp UI) may target net10.0 but reference AyCode.Core DLLs built as net9.0.
- No redundant code — before writing new logic, search for existing methods. Reuse or extract shared logic into smaller methods rather than duplicating. If an existing method does most of what you need, split it into composable parts.
- Keep all .md files in sync — when you modify code, update any affected .md file (README.md, docs/, GLOSSARY, ARCHITECTURE, CONVENTIONS, BINARY_FORMAT, SCHEMA, etc.). If you notice any .md content does not match the current code, fix it automatically.