1.6 KiB
1.6 KiB
MAPO-CORE Agent Instructions
Core Context
- Primary Goal: Optimization and refactoring of the
MP-SPEC.slnsolution, focusing on migrating legacy Redis/DB caching toFusionCache(Memory + Redis + DB) inMP.SPEC\Data\MpDataService.cs. - Language: C# (primary), PowerShell (scripts).
- Documentation/Comments: MUST be in Italiano.
- Code Style: Maintain existing region organization (
#region Public Methods, etc.). - Reference Docs: See
Refactor_Plan.mdfor the current migration status and detailed strategy.
Development Workflow
- Build & Verification:
- Use
./build_all_par.ps1 --agentto build all solutions silently. - Always verify that changes do not leave partial traces of old classes that break compilation.
- Use
- Refactoring Strategy (
MpDataService.cs):- Use
GetOrFetchAsync<T>(string operationName, string cacheKey, Func<Task<T>> fetchFunc, TimeSpan expiration, params string[] tags)as the standard for all data access. - Target methods currently using manual
redisDb.StringGetAsync/StringSetAsyncpatterns.
- Use
- Testing:
- Check the codebase for existing testing patterns before proposing new ones.
Architecture Notes
- Multi-Layer Caching: The system is transitioning from a dual-layer (Redis + DB) to a triple-layer approach via
IFusionCache. - Service Responsibility:
MpDataServiceis the central hub for data access, interacting withMpSpecController(EFCore) andMpMongoController(MongoDB). - Key Management: Cache keys are heavily managed via
Utils.redis...constants. Use these to prevent key mismatches.