Interface IGlobalDbEnvironment
Provides utility methods for a Database, operating on a IDataAccessor.
Gets and Sets flags on the database for upgrading and refreshing functionality, and
wraps Get and Set calls to properties on the Database's [dbo].[GlobalEnv]
table.
Namespace: LemonEdge.DataAccess.Core.Abstractions.Context
Assembly: LemonEdge.DataAccess.Core.Abstractions.dll
Syntax
public interface IGlobalDbEnvironment
Methods
ClearReUpgrading(IDbConnection)
Clears the ReUpgradeAllEntities
flag.
Declaration
Task<short> ClearReUpgrading(IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task<short> | A Task<TResult> indicating the state of the operation |
EnsureExists(IDbConnection)
Ensures that the table exist in the database with the specified DbConnection.
Declaration
Task EnsureExists(IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | cn | The DbConnection to check |
Returns
Type | Description |
---|---|
Task | A Task indicating the state of the operation |
GetAll(IDbConnection)
Gets all of the rows from table in a [Name],[Value]
format.
Declaration
Task<Dictionary<string, string>> GetAll(IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | cn | The DbConnection to use |
Returns
Type | Description |
---|---|
Task<Dictionary<string, string>> | A Dictionary of Name Value pairs |
GetStringValue(string, string, IDbConnection)
Fetches a value from the table, as a raw string. GetValue<T>(string, T, IDbConnection).
Declaration
Task<string> GetStringValue(string columnName, string defaultValue, IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
string | columnName | The name of the column to fetch |
string | defaultValue | The default, as a fallback |
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task<string> | The value from the table, as a string, or defaultValue |
GetValue<T>(string, T, IDbConnection)
Attempts to fetch a value from the table, and convert / cast it to T.
Declaration
Task<T> GetValue<T>(string columnName, T defaultValue, IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
string | columnName | The name of the column to fetch |
T | defaultValue | The default, as a fallback |
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task<T> | The value from the table, as type T, or defaultValue |
Type Parameters
Name | Description |
---|---|
T | The intended type of the result |
SetAndRetrieveValue(string, short, IDbConnection)
Sets and then returns the modified value for name.
Declaration
Task<short> SetAndRetrieveValue(string name, short value, IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the column to set |
short | value | The value |
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task<short> | A Task<TResult> indicating the state of the operation and the result |
SetStringValue(string, string, IDbConnection)
Sets a value in the table, as a raw string. SetValue<T>(string, T, IDbConnection).
Declaration
Task SetStringValue(string columnName, string value, IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
string | columnName | The name of the column to set |
string | value | The value |
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task | A Task indicating the state of the operation |
SetUpgrading(IDbConnection)
Sets the UpgradingDatabase
flag.
Declaration
Task<short> SetUpgrading(IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task<short> | A Task<TResult> indicating the state of the operation |
SetValue<T>(string, T, IDbConnection)
Attempts to set a value in the table, after a convert / cast from T.
Declaration
Task SetValue<T>(string columnName, T value, IDbConnection cn)
Parameters
Type | Name | Description |
---|---|---|
string | columnName | The name of the column to set |
T | value | The value |
IDbConnection | cn | The DbConnection |
Returns
Type | Description |
---|---|
Task | A Task indicating the state of the operation |
Type Parameters
Name | Description |
---|---|
T | The type of the input |