Contains factory methods for creating Database objects.
More...
Contains factory methods for creating Database objects.
◆ ClearDatabaseProviderFactory()
| static void Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.ClearDatabaseProviderFactory |
( |
| ) |
|
|
static |
◆ CreateDatabase() [1/2]
| static Database Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase |
( |
| ) |
|
|
static |
Creates the default Database object
Database dbSvc = DatabaseFactory.CreateDatabase();
- Returns
- The default database
- Exceptions
-
| System.Configuration.ConfigurationErrorsException | The configuration information cannot be read. |
| System.InvalidOperationException | The database factory has not been initialized or some configuration information is missing. |
◆ CreateDatabase() [2/2]
| static Database Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase |
( |
string |
name | ) |
|
|
static |
Creates the Database object with the specified name.
Database dbSvc = DatabaseFactory.CreateDatabase("SQL_Customers");
- Parameters
-
| name | The configuration key for database service |
- Returns
- The database with the specified name
- Exceptions
-
| System.Configuration.ConfigurationErrorsException | The configuration information cannot be read. |
| System.InvalidOperationException | The database factory has not been initialized or some configuration information is missing. |
◆ SetDatabaseProviderFactory()
| static void Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.SetDatabaseProviderFactory |
( |
DatabaseProviderFactory |
factory, |
|
|
bool |
throwIfSet = true |
|
) |
| |
|
static |
Sets the provider factory for the static DatabaseFactory.
- Parameters
-
| factory | The provider factory. |
| throwIfSet | true to thrown an exception if the factory is already set; otherwise, false. Defaults to true. |
- Exceptions
-
| InvalidOperationException | The factory is already set and throwIfSet is true. |
◆ SetDatabases()
| static void Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.SetDatabases |
( |
Func< Database > |
createDefaultDatabase, |
|
|
Func< string, Database > |
createNamedDatabase, |
|
|
bool |
throwIfSet = true |
|
) |
| |
|
static |
Sets the database mappings.
- Parameters
-
| createDefaultDatabase | A method that returns the default database. |
| createNamedDatabase | A method that returns a database for the specified name. |
| throwIfSet | true to thrown an exception if the factory is already set; otherwise, false. Defaults to true. |
- Exceptions
-
| InvalidOperationException | The factory is already set and throwIfSet is true. |
The documentation for this class was generated from the following file: