Appearance
TableInfo Class
Definition
Represents a database Table
- Namespace:
JASE.Database - Assembly:
JASE.Database.dll
Constructors
| Name | Description |
|---|---|
TableInfo(string name, string schema, NamingStrategy strategy) | Create an instance of TableInfo for the requested table and schema names |
Properties
| Name | Description |
|---|---|
CacheAttempts | Number of Attempts to read items from Cache |
CacheHits | Number of times Cache reads successfully returned data |
CacheKey | Returns the precomputed cache key representing this instance's effective configuration. |
Columns | Gets the list of columns defined in the table |
Comment | Comment / Description about the Table |
Constraints | Gets the list of constraints defined for the table (e.g., foreign keys, checks). |
EstimatedRows | Estimated number of rows in the table |
FillFactor | Table storage fill factor (Postgres heap). A value of 0 omits the option (provider default). |
HasCacheKey | Returns true if CacheKey record has been set |
HasProviderMetadata | Returns true if the TableInfo has been hydrated with provider metadata (database sync'd metadata) |
ImmutableRows | When true, rows are not allowed to be modified after INSERT |
Indexes | Gets the list of indexes defined on the table |
IsView | When true, this selectable maps to a database view and write APIs are refused. |
NamingStrategy | Naming strategy used for this TableInfo object |
PrimaryKeyColumn | Gets the name of the column designated as the table's primary key |
PrimaryKeyName | Gets the name of the database constraint used as the primary key |
RelatedProperties | Reference navigations discovered via RelatedAttribute. |
RenamedFrom | Gets the previous database table name associated with the decorated class. |
Type | Class Type when generated from a class |
Methods
| Name | Description |
|---|---|
bool AddColumn(IColumnInfo column) | Add a column |
bool AddConstraint(Constraint constraint) | Adds a table-level constraint (for example a foreign key) and attaches it to the matching column when present. |
bool AddIndex(IndexInformation index) | Adds a non-primary-key index and attaches it to matching key columns when present. |
bool CommentEquals(ITableInfo other) | Returns when this table and other have the same comment. |
ulong ComputeShapeSignature() | Computes a stable FNV-1a signature of this table's column shape for dynamic cache keys. |
TableInfo Copy() | Ceates a copy of the instance |
TableInfo EnsureDynamicCacheKey(ISqlGenerator generator, TableInfoOptions options = null, ulong? shapeSignature = null) | Assigns a dynamic CacheKey so statement pools and binders can cache this shape. |
void EnsureWritable() | Throws when this selectable is a view and must not be used for writes. |
IReadOnlyList<string> GetColumnNames() | Returns column names for SELECT projections: primary key first (when present), then remaining columns alphabetically by name. |
IReadOnlyList<IColumnInfo> GetColumns(ColumnLayout order) | |
Task<IReadOnlyList<Constraint>> GetConstraints(IDatabaseSession connection, int commandTimeout = null) | Retrieves CONSTRAINT information from the database and returns list |
byte[] GetHash(HashProvider hash = null) | Get Hash of the current instance |
Task<IReadOnlyList<IndexInformation>> GetIndexes(IDatabaseSession connection, int commandTimeout = null) | Retrieves INDEX information from the database and returns list |
string GetInsertColumns(Delimiters delimiters) | Returns a comma delimited string representing the columns to be inserted to the database in provider specific format |
string GetMigrationJson() | Returns a JSON representation of the TableInfo data suitable for tracking schema migration changes |
IReadOnlyList<string> GetMutableColumnNames() | Returns a readonly list of the Column names (in ordinal order when known) that are not marked immutable |
TableInfo GetOrCreate(Type type, ISqlGenerator generator, string schema = null, TableInfoOptions options = null, bool forceRefresh = null) | Generate a TableInfo object by reflecting a Type and its properties. |
IColumnInfo GetPkColumn() | Returns the IColumnInfo data for the tables Primary Key |
IPredicateNode GetPkPredicate() | Returns a predicate node designed to obtain a row by it's primary key |
Task HydrateDatabaseMetadata(IDatabaseSession connection) | Hydrates this table definition with provider-specific metadata retrieved from the database. |
NamingStrategy InferNamingStrategy(bool updateStrategy = null) | Analysis characteristics of the TableInfo and derive it's NamingStrategy. Useful when TableInfo was created from a database table |
bool IsNormalized(NamingStrategy strategy) | Compares instance names against NamingStrategy |
string ToNamingStrategy(string input) | Converts input value to NamingStrategy |
bool TryGetColumnInfo(string columnName, out IColumnInfo column) | Resolves provided column to it's IColumnInfo using a case insensitive comparater |
void Validate() | Validates hand-built or mutated metadata before CRUD/materialization (e.g. dynamic tables). |