Table of Contents

Namespace CL.MySQL2.Models

Classes

ColumnAttribute

Maps a property to a database column with optional schema metadata.

CompositeIndexAttribute

Declares a composite index spanning multiple columns. Apply to the class (not a single property) by using the index column names. Can be applied multiple times for multiple composite indexes.

CursorPagedResult<T>

Represents one forward-only page from a cursor-paged query.

ForeignKeyAttribute

Declares a foreign key constraint on a column property.

IgnoreAttribute

Excludes a property from all database operations (read, write, schema sync).

IndexAttribute

Declares an index on the annotated property. Supersedes Column(Index=true) — provides control over the name, uniqueness, and covering Include columns. Can appear multiple times per property for rare multi-index cases.

Include lets you build a covering index: leaf pages carry the named extra columns so queries that filter on the indexed column and project only the included columns can answer from the index alone (no PK lookup per row). Property names map to their underlying column names via Name.

Migration

Convenience base for IMigration. Supplies Version and Description from the constructor and a DownAsync(IMigrationContext, CancellationToken) that throws (override it to make the migration reversible).

PagedResult<T>

Represents a page of results from a paged query.

RetainDaysAttribute

Declares a retention policy for the annotated entity. The library's background purge worker periodically deletes rows whose TimestampColumn is older than Days. Replaces hand-rolled cleanup jobs.

SoftDeleteAttribute

Marks an entity for soft deletes. DeleteAsync(object, CancellationToken) sets the named timestamp column to the current UTC time instead of issuing a physical DELETE, and reads through mysql.Query<T>() and the repository getters automatically exclude rows where that column is set (WHERE col IS NULL). Opt back in to deleted rows with .IncludeDeleted() on a query, or purge for real with HardDeleteAsync(object, CancellationToken).

The referenced property must be a nullable DateTime mapped to a NULL-able DATETIME column. Auto soft-delete filtering applies to single-table queries and repository reads — not to joins, subqueries, or bulk UpdateAsync/DeleteAsync on the query builder.

SyncResult

The result of a table synchronization operation.

TableAttribute

Marks a class as a database table entity. Apply to a class to enable table sync and repository operations.

Structs

MigrationVersion

Identifies a migration's position in the ordered sequence: the application version it ships with, then an explicit order within that version. Sorts by semantic version, then order.

Interfaces

IMigration

An explicit, ordered, imperative migration — for data transforms, seeds, and semantic schema changes that the declarative CRC-gated sync cannot express. Discovered by registration or assembly scan and run by the MigrationRunner in Version order.

Enums

Charset

MySQL character set options.

DataType

MySQL column data types.

ForeignKeyAction

Referential action for ON DELETE / ON UPDATE foreign key clauses.

JoinType

SQL JOIN types.

SchemaSyncLevel

Controls how aggressively the table sync service reconciles the live database schema with entity definitions. Higher levels allow more destructive operations.

SortOrder

Sort order for query results.

StorageType

Optional physical-storage override for a column. When set to anything other than Default, the storage type takes precedence over DataType for DDL generation. For certain CLR types automatic value conversion is applied (e.g. a Guid property with Binary is stored as BINARY(16) with big-endian byte conversion).

SyncMode

Operator-facing schema sync mode. This is the primary knob exposed in configuration; it maps onto an internal SchemaSyncLevel and governs how the CRC-gated __schema_state sentinel reconciles the database with the entity models.

TableEngine

MySQL storage engine options.