xpo-devexpress-dot-xpo-dot-xpodefault-dot-getdatalayer-x28-system-dot-string-devexpress-dot-xpo-dot-metadata-dot-xpdictionary-devexpress-dot-xpo-dot-db-dot-autocreateoption-system-dot-idisposable-x29.md
Creates a data access layer.
Namespace : DevExpress.Xpo
Assembly : DevExpress.Xpo.v25.2.dll
NuGet Package : DevExpress.Xpo
public static IDataLayer GetDataLayer(
string connectionString,
XPDictionary dictionary,
AutoCreateOption defaultAutoCreateOption,
out IDisposable[] objectsToDisposeOnDisconnect
)
Public Shared Function GetDataLayer(
connectionString As String,
dictionary As XPDictionary,
defaultAutoCreateOption As AutoCreateOption,
ByRef objectsToDisposeOnDisconnect As IDisposable()
) As IDataLayer
| Name | Type | Description |
|---|---|---|
| connectionString | String |
A connection string.
| | dictionary | XPDictionary |
A persistent classes metadata provider.
| | 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.
|
| Type | Description |
|---|---|
| IDataLayer |
An IDataLayer object.
|
If the application no longer needs a data layer object, dispose each object on the objectsToDisposeonDisconnect array.
If the value passed to the connectionString parameter is a reference to Data Store Service (URL), the method connects SimpleDataLayer to a Data Store Service client.
The GetDataLayer 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 Core.
|
To connect a .NET Core project to a Data Store Service, create and configure DataStoreClientAsync or CachedDataStoreClient. For additional information, see WCF Client in .NET Core.
|
Tip
Dispose of a data layer instance when it is no longer in use to release the resources it holds.
See Also