Application Ledger Schemas (AppDbContext)
Application Ledger Schemas (AppDbContext)
The primary master database context for Asterisk 2 is built on Entity Framework Core relational mappings. It acts as the central brain managing multi-tenant organizational records, documentation navigation trees, customized interface aesthetics, and dynamic feature scoping parameters.
Relational Entity Topology Blueprint
The diagram below illustrates the core data tables and primary/foreign key connections managed by the framework ledger:
graph TD
%% Core Tenant Metadata
subgraph MasterEntities["Application Control Tier"]
T_Org[("Organizations Table<br/>(PK: Id, Slug)")]
T_Set[("AppSettings Table<br/>(Branding Overrides)")]
T_Key[("ApiKeys Table<br/>(Machine Identity Hashes)")]
end
%% Hierarchical Content Ledger
subgraph ContentHierarchy["Documentation Tree Structure"]
T_Proj[("Projects Table<br/>(PK: Id, FK: OrgId)")]
T_Sec[("Sections Table<br/>(PK: Id, FK: ProjectId)")]
T_Page[("Pages Table<br/>(PK: Id, FK: SectionId, ParentPageId)")]
end
%% ASP.NET Identity Core
subgraph SecurityLedger["Identity Auth Schemas"]
T_User[("AspNetUsers Table<br/>(PK: Id, FK: OrgId)")]
T_Role[("AspNetRoles Table<br/>(RBAC Claims Mapping)")]
end
%% Foreign Key Routes
T_Org ==>|"One-to-Many Ownership"| T_Proj
T_Org ==>|"One-to-Many Membership"| T_User
T_Org ==>|"Scoped Token Mapping"| T_Key
T_Proj ==>|"Cascade Section Tree"| T_Sec
T_Sec ==>|"Cascade Page Arrays"| T_Page
T_Page -.->|"Recursive Hierarchy<br/>(ParentPageId Restrict)"| T_Page
T_User <==>|"UserRole Linking"| T_Role
%% Styling Elements
classDef mainToken fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff,rx:6px,ry:6px;
classDef contentToken fill:#1e293b,stroke:#a855f7,stroke-width:2px,color:#fff,rx:6px,ry:6px;
classDef secToken fill:#312e81,stroke:#ec4899,stroke-width:2px,color:#fff,rx:6px,ry:6px;
class MasterEntities,T_Org,T_Set,T_Key mainToken;
class ContentHierarchy,T_Proj,T_Sec,T_Page contentToken;
class SecurityLedger,T_User,T_Role secToken;
Structural Modeling Directives
1. Fluent Schema Interception (OnModelCreating)
To prevent infinite database query cycles during record removal operations, nested entity relationships override default Entity Framework cascade deleting workflows. The hierarchical self-referencing relationship inside Page entities is restricted to manual tree unbinding (DeleteBehavior.Restrict).
2. Isolated Workspace Query Contexts
All commercial application database transactions append global record query criteria ensuring operations evaluate entity fields against matching user claims identity properties.