XpoDefault.GetDataLayer(String, XPDictionary, AutoCreateOption, out IDisposable[]) Method
Creates a data access layer.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.2.dll
NuGet Package: DevExpress.Xpo
#Declaration
public static IDataLayer GetDataLayer(
string connectionString,
XPDictionary dictionary,
AutoCreateOption defaultAutoCreateOption,
out IDisposable[] objectsToDisposeOnDisconnect
)
#Parameters
Name | Type | Description |
---|---|---|
connection |
String | A connection string. |
dictionary | XPDictionary | A persistent classes metadata provider. |
default |
Auto |
Specifies whether XPO can create a database or update its schema. |
objects |
IDisposable[] | An array of IDisposable objects the data store provider creates internally. |
#Returns
Type | Description |
---|---|
IData |
An IData |
#Remarks
If the application no longer needs a data layer object, dispose each object on the objectsToDisposeonDisconnect array.
The GetDataLayer method throws CannotFindAppropriateConnectionProviderException in the following situations:
A connection string does not contain the Xpo | To get a fully qualified connection string, use the Get |
A connection string references a Data Store Service and a target platform is .NET Core. | To connect a .NET Core project to a Data Store Service, create and configure Data |
Tip
Dispose of a data layer instance when it is no longer in use to release the resources it holds.