.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.0+

XpoDefault.GetConnectionProvider(String, AutoCreateOption, out IDisposable[]) Method

Creates a data store provider (an IDataStore instance).

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.2.dll

Declaration

public static IDataStore GetConnectionProvider(
    string connectionString,
    AutoCreateOption defaultAutoCreateOption,
    out IDisposable[] objectsToDisposeOnDisconnect
)
Public Shared Function GetConnectionProvider(
    connectionString As String,
    defaultAutoCreateOption As AutoCreateOption,
    ByRef objectsToDisposeOnDisconnect As IDisposable()
) As IDataStore

Parameters

Name Type Description
connectionString String

A connection string.

defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

objectsToDisposeOnDisconnect IDisposable[]

An array of IDisposable objects the data store provider creates internally.

Returns

Type Description
IDataStore

A data store provider.

Remarks

If the application no longer needs a connection provider object, dispose each object on the objectsToDisposeonDisconnect array.

The GetConnectionProvider method uses the ActiveConnectionString property if the connectionString parameter value is null (Nothing in Visual Basic).

If the value passed to the connectionString parameter is a reference to Data Store Service (URL), the method returns a Data Store Service client.

The GetConnectionProvider method throws CannotFindAppropriateConnectionProviderException in the following situations:

A connection string does not contain the XpoProvider attribute and XPO cannot infer the provider name from other attributes.

To get a fully qualified connection string, use the GetConnectionString method of a corresponding connection provider.

A connection string references a Data Store Service and a target platform is .NET Standard or .NET Core.

To connect a .NET Standard/.NET Core project to a Data Store Service, create and configure DataStoreClientAsync or CachedDataStoreClient. For additional information, see WCF Client in .NET Core.

See Also