Skip to content
bitzorcas
EN

Concept

ORM Adapter Pattern

The four-tier adapter switching strategy (Default → Production → Optional → Unavailable).

Last updated

Overview

The ORM adapter pattern diagram shows BitzOrcas.Modern’s switchable persistence strategy. The system provides three ORM adapters: SqlSugar (default production adapter), EF Core (optional alternative), and Dapper (read-only query optimization). Through DI-based strategy pattern, each module can switch adapters at runtime without changing business code.

Key takeaways

  • SqlSugar — default ORM with full CRUD + global filters + transaction support
  • EF Core — optional alternative, maintaining CAP compatibility via CapSqlSugarUnitOfWork
  • Dapper — used only for read-only query scenarios like audit logs, bypassing ORM overhead
  • Adapters are registered via AddScoped<IXxxRepository, SqlSugarXxxRepository>
  • Business code depends only on interfaces (e.g. INoteRepository), never directly on ORM implementations