Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

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

Creates a data layer for the specified connection string and metadata information and returns objects that need to be disposed of when a connection to a data store is closed.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.1.dll

Declaration

public static IDataLayer GetDataLayer(
    string connectionString,
    XPDictionary dictionary,
    AutoCreateOption defaultAutoCreateOption,
    out IDisposable[] objectsToDisposeOnDisconnect
)

Parameters

Name Type Description
connectionString String

A connection string to a data store.

dictionary XPDictionary

An XPDictionary object that provides the metadata information.

defaultAutoCreateOption AutoCreateOption

An AutoCreateOption value that specifies which operations should be performed when a data store is accessed for the first time.

objectsToDisposeOnDisconnect IDisposable[]

Returns an array of objects that should be disposed of when a connection to a data store is closed.

Returns

Type Description
IDataLayer

The created SimpleDataLayer object.

Remarks

This method creates a corresponding IDataStore object based on the specified connectionString and defaultAutoCreateOption parameters and then creates a SimpleDataLayer object that wraps round the created IDataStore object. After this method has been called, the objectsToDisposeOnDisconnect parameter will contain the objects that must be manually disposed of when the connection to the data store is closed.

The value returned by this method can be used to initialize the XpoDefault.DataLayer property or passed to a Session object’s constructor.

See Also