Skip to content

BaseTable1 Class` ​

Definition ​

Implements core functionality for classes inheriting from JASE.Database.BaseTable

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

Methods ​

NameDescription
Task<bool> CheckTableExist(IDatabaseSession connection)Checks if the specified Table exist in the database
bool Delete(IConnection conn, int commandTimeout = null)DELETE the current entry based on it's primary key value
Task<int> DeleteList(IDatabaseSession connection, IEnumerable<T> list, int commitInterval = null, int commandTimeout = null)DELETE a list of records by primary key.
Task<SC> First(IDatabaseSession connection, QueryBuilder<SC> query)Returns the first matching record
Task<List<SC>> GetAll(IDatabaseSession connection, IEnumerable<string> columns = null, IList<OrderBy> orderBy = null)Returns all records for a table
Task<SC> GetByPk(IDatabaseSession connection, object identifier)Fetches the requested record from the database based on the Primary Key value
IReadOnlyDictionary<string, object> GetDirty()Returns a read only Dictionary of values detected as Dirty
Task<SC> GetExistingColumns(IDatabaseSession connection, QueryBuilder<SC> query)Fetches the first requested record from the database based on the QueryBuilder predicates returning currently defined columns
Task<List<SC>> GetList(IDatabaseSession connection, QueryBuilder<SC> query)Fetches a list of records matching the query predicte
List<string> GetListColumnNames()Returns a list of column names for the base class
List<string> GetListColumnNames(IDatabaseSession connection)Returns a list of column names currently on the database table
Task<List<SC>> GetListExistingColumns(IDatabaseSession connection, QueryBuilder<SC> query)Fetches a list of entries from the database based on the QueryBuilder predicates returning currently defined columns
IAsyncEnumerable<SC> GetListStream(IDatabaseSession connection, QueryBuilder<SC> query)Executes the specified query and returns the results as an asynchronous stream of SC instances.
object GetPkValue()Get the records Primary Key value
string GetPropertyName(string column)Resolve a column name to a property name
TableInfo GetTableInfo()Returns a copy of the inheriting classes TableInfo
bool HasImmutableProperty()Returns true if BaseTable<SC> contains any properties with both ColumnInfoAttribute and ImmutablePropertyAttribute
void Initialize(IConnection connection)Performs initiazliation based on the SC class
bool Initialized()Returns true/false the state of internal initialization for inheriting class type
Task<int> InsertList(IDatabaseSession connection, IEnumerable<T> list, int commitInterval = null, int commandTimeout = null)INSERT a list of records into the database table
bool IsDirty()Compares database values with current values for equality
bool LoadedFromDB()Check if the record is thought to have been loaded from the database table
QueryBuilder<SC> Query()Initializes a QueryBuilder object for the inheriting class
QueryBuilder<SC> Query(Expression<Func<SC, bool>> filter)Initializes a [QueryBuilder`1](/api/database/QueryBuilder_1/) for the inheriting class with an initial `WHERE` filter.
Task<bool> Save(IDatabaseSession connection, bool upsert = null, int commandTimeout = null)Save the current entry to the database table
bool TrackChanges(IEnumerable<T> list)Initiates tracking of Property value changes relative to current state
void TrackChanges()Initiates tracking of Property value changes relative to current state
Task<bool> Truncate(IDatabaseSession connection)Execute a TRUNCATE statement on the underlying database table for the current model ** DANGEROUS **
Task<int> UpdateList(IDatabaseSession connection, IEnumerable<T> list, int commitInterval = null, int commandTimeout = null)UPDATE a list of records based on detected dirty properties/columns
Task<int> UpsertList(IDatabaseSession connection, IEnumerable<T> list, int commitInterval = null, int commandTimeout = null, UpsertConflictAction conflictAction = null)UPSERT - Performs an INSERT or UPDATE to a list of records based on existence in the database