XpoDefault.GetConnectionProvider(String, AutoCreateOption, out IDisposable[]) Method
Creates an instance of a connection provider using the specified settings.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v18.2.dll
Declaration
public static IDataStore GetConnectionProvider(
string connectionString,
AutoCreateOption defaultAutoCreateOption,
out IDisposable[] objectsToDisposeOnDisconnect
)
Parameters
Name | Type | Description |
---|---|---|
connectionString | String | The connection string which is used to instantiate a connection provider. |
defaultAutoCreateOption | AutoCreateOption | A AutoCreateOption enumeration value that specifies the action which is performed when a session is connected to a data store. |
objectsToDisposeOnDisconnect | IDisposable[] | An array of IDisposable objects that must be disposed on disconnect from the datasource. |
Returns
Type | Description |
---|---|
IDataStore | The created connection provider. |
Remarks
If the value passed to the connectionString parameter equals null (Nothing in VB), the XpoDefault.ActiveConnectionString is used to instantiate the connection provider.
Example
The following code snippet shows how to create an instance of the SimpleDataLayer without first creating the data layer cache. The data layer is instantiated using the XpoDefault.ActiveConnectionString.
using DevExpress.Xpo;
using DevExpress.Xpo.DB;
//...
SimpleDataLayer dataLayer = new SimpleDataLayer(
XpoDefault.GetConnectionProvider(AutoCreateOption.DatabaseAndSchema));
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetConnectionProvider(String, AutoCreateOption, out IDisposable[]) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.