Database Services
The mmDataBaseManager class provides your application with database services.
Referencing mmDatabaseManager
To reference this object from anywhere in your application, use the static DatabaseMgr property of the mmAppBase class.For example, in C#:
// Use namespace at the top of your source code file using OakLeaf.MM.Main;
var connectionString = mmAppBase.DatabaseMgr.GetConnectionString("Northwind");
And in VB .NET:
'' Import namespace at the top of your source code file Imports OakLeaf.MM.Main
Dim connectionString = mmAppBase.DatabaseMgr.GetConnectionString("Northwind")
Database Manager Members
Here is a description of the main properties and methods of mmDatabaseManager (C# code is shown first and VB .NET second):- DatabaseSetKey - Property that contains the key of the current Database set (if any). This property is automatically set by selecting a Database Set from the options dialog or can be set programmatically at run time.
- GetAllDatabaseInfo - Returns a NameValueCollection containing all database information in the application configuration file.
public virtual NameValueCollection GetAllDatabaseInfo()
Public Overridable Function GetAllDatabaseInfo() As NameValueCollection
- GetDatabaseInfoByDatabaseSet - Returns a NameValueCollection containing all database information in the application configuration file for the specified database set key.
public virtual NameValueCollection GetDatabaseInfoByDatabaseSet(string databaseSetKey)
Public Overridable Function GetDatabaseInfoByDatabaseSet(databaseSetKey As String) As NameValueCollection
- GetDatabaseNames - This method has two overloads that return an ArrayList containing all database names found in the application configuration file.
- Returns an ArrayList containing all database names found in the application configuration file.
public virtual ArrayList GetDatabaseNames()
Public Overridable Function GetDatabaseNames() As ArrayList
- Returns an ArrayList containing all database names for the specified database set key found in the application configuration file.
public virtual ArrayList GetDatabaseNames(string databaseSetKey)
Public Overridable Function GetDatabaseNames(databaseSetKey As String) As ArrayList
- Returns an ArrayList containing all database names found in the application configuration file.
- GetDbcKeyFromConfigConnection - Extracts the database name from the configuration file connection string entry.
public static string GetDbcKeyFromConfigConnection(string configString, string databaseSetKey)
Public Shared Function GetDbcKeyFromConfigConnection(configString As String, databaseSetKey As String) As String
- GetDbcNameFromConnectString - Returns the database name from the connection string.
public static string GetDbcNameFromConnectString(string connectString)
Public Shared Function GetDbcNameFromConnectString(connectString As String) As String
- GetSecurityDatabaseKey - Returns the security database key. This method first tries to retrieve the security database key value from the application configuration file (app.config or web.config). If it's not specified, it checks if there is only a single database being used in the application. If so, it returns this database key instead.
public virtual string GetSecurityDatabaseKey()
Public Overridable Function GetSecurityDatabaseKey() As String
See Also:
Specifying Connection Strings and Database Settings
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 05/01/18
Comment or report problem with topic
