ConnectionManager Class
From RemObjects Software
This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.
Overview (.NET)
Includes the functionality required to handle a list of database connection definitions, instantiate actual connections and determine pooling settings.
The list of connections known to your server is loaded by using one of the several Load methods of this class (by default the parameter-less one) at startup. Once the list is loaded, you can then create a new connection or acquire them from pools by using the AcquireConnection method. Once you're done using the connection, you will need to return it to the connection manager through the use of the ReleaseConnection method.
The PoolingEnabled property determines if you want Data Abstract to use its own pooling mechanism rather than relying on ADO.NET's (which might or might not be available in some ADO.NET data providers). For additional pooling options, look at the PoolingBehavior, PoolTimeoutSeconds, WaitIntervalSeconds and MaxPoolSize properties.
Namespace
Declaration (C#)
[XmlRename("Connections"), ToolboxBitmap(typeof(ConnectionManager), "Glyphs.ConnectionManager.bmp")] public class ConnectionManager : XmlSerializableComponent;
Hierarchy
- XmlSerializableComponent
- RemObjects.DataAbstract.Server.ConnectionManager
Properties
| | | |
|---|---|---|
| ConnectionDefinitions | ConnectionDefinitionCollection | Provides access to the list of connection definitions held by the connection manager. |
| DefaultConnectionDefinition | ConnectionDefinition | Returns the connection definition, whose Default property is set to true, from the list referenced by the property ConnectionDefinitions. |
| DefaultConnectionName | String | Returns the name of the connection returned by DefaultConnectionDefinition or an empty string if that property returns null. |
| MaxPoolSize | Integer | Defines the maximum number of connections that connection pools can hold. |
| PoolingBehavior | PoolBehavior | Determines how the connection pool behaves if no connections are available to serve a call to AcquireConnection.
Depending on the assigned value, AcquireConnection will either wait until a connection becomes available, return an error, or create a new unpooled connection. |
| PoolingEnabled | Boolean | Determines if Data Abstract connection pooling should be enabled or not. |
| PoolTimeoutSeconds | Integer | |
| WaitIntervalSeconds | Integer | Determines how many seconds to wait for a connection to be released from a pool before timing out. |
Methods
| | |
|---|---|
| AcquireConnection | Returns a connection whose connection string is the same as the connection definition with the given name.
The Boolean parameter determines if you want the connection to be opened automatically or not. |
| AddDefinition | Adds a connection definition to the ConnectionDefinitions collection.
Makes the similar action as ConnectionDefinitions.Add. |
| ConnectionManager | Default constructor for ConnectionManager. |
| Load | Loads a Data Abstract connections file using the default mechanism, which looks in several places for a valid .daConnections file:
If your application does not provide a custom DataAbstract.daConfig, either as file or as embedded resource, the call will fail with an exception. |
| LoadFromFile | Loads a Data Abstract connection from the specified file.
If the filename is empty, the configuration will be loaded from a <ApplicationName>.daConnctions file next to your application's executable. |
| LoadFromResource | Loads a Data Abstract connection from a resource in your application's executable.
If the resource name is empty, the connections will be loaded from a resource named <ApplicationName>.daConnctions. |
| LoadFromXml | Loads a Data Abstract connections from an XmlDocument.
Use this method if you want to obtain the list of connections by other means then from a local file or a resource. |
| ReleaseConnection | Releases a connection previously acquired using the AcquireConnection method.
If the connection originally belonged to a pool, it is returned to it. In either case, the variable referenced by method's parameter is set to null. |
Events
| | |
|---|---|
| ConnectionAcquired | Occurs whenever a connection is returned by the AcquireConnection method.
Note: This event occurs whether or not the connection is held in a pool. |
| ConnectionCreated | Occurs whenever a new connection is created during a call to AcquireConnection.
Note: This event only occurs if connection manager pooling is not enabled. |
| ConnectionReleased | Occurs anytime a connection is released through the use of the ReleaseConnection method. |
See Also
Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)
Lists — Glossary — Features — How To — Drivers — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | Data Abstract | Architecture | Class | .NET
