Class DatabaseConnectionManager
Maintains a cache of database connection contexts
Inheritance
Implements
Namespace: MESL.SqlRace.Domain
Assembly: MESL.SqlRace.Domain.dll
Syntax
public class DatabaseConnectionManager : Object, IConnectionManager
Constructors
DatabaseConnectionManager()
Initializes a new instance of the DatabaseConnectionManager class.
Declaration
public DatabaseConnectionManager()
Fields
SqlStreamFolderDefaultName
Sql Stream Folder Default Name.
Declaration
public const string SqlStreamFolderDefaultName = "Filestreams"
Field Value
Type | Description |
---|---|
System.String |
Methods
CanWriteToFolder(String)
Tests if a full folder name is writable
Declaration
public static bool CanWriteToFolder(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | full folder name |
Returns
Type | Description |
---|---|
System.Boolean | true if the folder is writable |
CreateSqliteConnectionStr(String)
Creates SQlite connection string from a full file name
Declaration
public static string CreateSqliteConnectionStr(string sqLiteFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sqLiteFileName | SQlite full file name |
Returns
Type | Description |
---|---|
System.String | SQlite connection string |
CreateSqliteRootPath(String)
Creates SQlite RootPath from a full file name
Declaration
public static string CreateSqliteRootPath(string sqLiteFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sqLiteFileName | SQlite full file name |
Returns
Type | Description |
---|---|
System.String | RootPath full folder name |
GetCacheSize(String)
Get the cache size token from the connection string
Declaration
public static Nullable<int> GetCacheSize(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string |
Returns
Type | Description |
---|---|
System.Nullable<System.Int32> |
GetConnectionContext(ConnectionInformationBase)
Gets the connection context.
Declaration
public ConnectionContextBase GetConnectionContext(ConnectionInformationBase connectionInformation)
Parameters
Type | Name | Description |
---|---|---|
ConnectionInformationBase | connectionInformation | The connection information. |
Returns
Type | Description |
---|---|
ConnectionContextBase | Returns connection context |
GetDatabaseConnections(Boolean)
Gets the database connections
Declaration
public IEnumerable<DatabaseConnection> GetDatabaseConnections(bool forceReloadFromFile = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | forceReloadFromFile |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<DatabaseConnection> | List of DatabaseConnection |
GetDatabaseVersion(String)
Gets the database version.
Declaration
public static string GetDatabaseVersion(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
Returns
Type | Description |
---|---|
System.String |
GetDataSource(String)
Get the Data Source from the connection string
Declaration
public static string GetDataSource(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string |
Returns
Type | Description |
---|---|
System.String |
GetDbEngine(String)
Get the dbEngine from the connection string
Declaration
public static DbEngine GetDbEngine(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string |
Returns
Type | Description |
---|---|
DbEngine | The DbEngine parsed from the connection string. Defaulted to DbEngine.SQLRace |
GetFileStreamType(String)
Declaration
public static string GetFileStreamType(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString |
Returns
Type | Description |
---|---|
System.String |
GetPooling(String)
Get the pooled token from the connection string
Declaration
public static Nullable<bool> GetPooling(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> |
GetRootPathForConnectionString(String)
Gets the root path for a specified connection string.
Declaration
public string GetRootPathForConnectionString(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | The connection string. |
Returns
Type | Description |
---|---|
System.String |
GetSqliteFileNameFromConnectionStr(String, out Boolean)
Converts SQlite connection string, if valid, to its full file name
Declaration
public static string GetSqliteFileNameFromConnectionStr(string connectionStr, out bool isSQlite)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionStr | SQlite connection string |
System.Boolean | isSQlite | true if a valid SQlite connection string |
Returns
Type | Description |
---|---|
System.String | its full file name |
GetSqliteSessionIndexingCacheConnection()
Gets the sqlite session indexing cache connection.
Declaration
public DatabaseConnection GetSqliteSessionIndexingCacheConnection()
Returns
Type | Description |
---|---|
DatabaseConnection |
LoadSqlRaceConnections()
Loads the SQL race connections.
Declaration
public IEnumerable<ConnectionBase> LoadSqlRaceConnections()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ConnectionBase> |
SaveConnections()
Saves the DB Connections.
Declaration
public void SaveConnections()
UpdateConnectionsList(IList<DatabaseConnection>)
Updates the connections list.
Declaration
public void UpdateConnectionsList(IList<DatabaseConnection> loadedConnections)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<DatabaseConnection> | loadedConnections | The loaded connections. |
Explicit Interface Implementations
IConnectionManager.GetDataSource(String)
Declaration
string IConnectionManager.GetDataSource(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString |
Returns
Type | Description |
---|---|
System.String |
IConnectionManager.GetDbEngine(String)
Get the DbEngine for the specified connection string
Declaration
DbEngine IConnectionManager.GetDbEngine(string connectionString)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString |
Returns
Type | Description |
---|---|
DbEngine | DbEngine |