Skip to content

TableInfo Class ​

Definition ​

Represents a database Table

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Constructors ​

NameDescription
TableInfo(string name, string schema, NamingStrategy strategy)Create an instance of TableInfo for the requested table and schema names

Properties ​

NameDescription
CacheAttemptsNumber of Attempts to read items from Cache
CacheHitsNumber of times Cache reads successfully returned data
CacheKeyReturns the precomputed cache key representing this instance's effective configuration.
ColumnsGets the list of columns defined in the table
CommentComment / Description about the Table
ConstraintsGets the list of constraints defined for the table (e.g., foreign keys, checks).
EstimatedRowsEstimated number of rows in the table
FillFactorTable storage fill factor (Postgres heap). A value of 0 omits the option (provider default).
HasCacheKeyReturns true if CacheKey record has been set
HasProviderMetadataReturns true if the TableInfo has been hydrated with provider metadata (database sync'd metadata)
ImmutableRowsWhen true, rows are not allowed to be modified after INSERT
IndexesGets the list of indexes defined on the table
IsViewWhen true, this selectable maps to a database view and write APIs are refused.
NamingStrategyNaming strategy used for this TableInfo object
PrimaryKeyColumnGets the name of the column designated as the table's primary key
PrimaryKeyNameGets the name of the database constraint used as the primary key
RelatedPropertiesReference navigations discovered via RelatedAttribute.
RenamedFromGets the previous database table name associated with the decorated class.
TypeClass Type when generated from a class

Methods ​

NameDescription
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).