mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 23:56:32 +00:00
d320d6dd59
Made-with: Cursor
1.4 KiB
1.4 KiB
Module: Azaion.Common.Database.AzaionDbSchemaHolder
Purpose
Static holder for the linq2db MappingSchema that maps C# entities to PostgreSQL table/column naming conventions and handles custom type conversions.
Public Interface
| Member | Type | Description |
|---|---|---|
MappingSchema |
static readonly MappingSchema |
Pre-built schema with column name and type mappings |
Internal Logic
Static constructor:
- Creates a
MappingSchemawith a global callback that converts all column names to snake_case viaStringExtensions.ToSnakeCase. - Uses
FluentMappingBuilderto configure theUserentity:- Table name:
"users" Id: primary key,DataType.GuidRole: stored as text, with custom conversion to/fromRoleEnumviaEnum.ParseUserConfig: stored as nullable JSON text, serialized/deserialized viaNewtonsoft.Json
- Table name:
Dependencies
User,RoleEnumentitiesStringExtensions.ToSnakeCase- linq2db
MappingSchema,FluentMappingBuilder Newtonsoft.Json
Consumers
DbFactory.LoadOptions— passesMappingSchematoDataOptions.UseMappingSchema()
Data Models
Defines the ORM mapping for the users table.
Configuration
None — all mappings are compile-time.
External Integrations
None directly; mappings are used when queries execute against PostgreSQL.
Security
None.
Tests
None.