Back to Devexpress

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

xpo-devexpress-dot-xpo-dot-xpodefault-dot-getdatalayer-x28-system-dot-data-dot-idbconnection-devexpress-dot-xpo-dot-metadata-dot-xpdictionary-devexpress-dot-xpo-dot-db-dot-autocreateoption-system-dot-idisposable-x29.md

latest3.6 KB
Original Source

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

Creates a data layer for the specified connection 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.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public static IDataLayer GetDataLayer(
    IDbConnection connection,
    XPDictionary dictionary,
    AutoCreateOption autoCreateOption,
    out IDisposable[] objectsToDisposeOnDisconnect
)
vb
Public Shared Function GetDataLayer(
    connection As IDbConnection,
    dictionary As XPDictionary,
    autoCreateOption As AutoCreateOption,
    ByRef objectsToDisposeOnDisconnect As IDisposable()
) As IDataLayer

Parameters

NameTypeDescription
connectionIDbConnection

An object implementing the IDbConnection interface that represents an open connection to a data source.

| | dictionary | XPDictionary |

An XPDictionary object that provides the metadata information.

| | autoCreateOption | 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

TypeDescription
IDataLayer

The created SimpleDataLayer object.

|

Remarks

This method creates a corresponding IDataStore object based on the specified connection and autoCreateOption parameters and then creates a SimpleDataLayer object that wraps 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

DataLayer

SimpleDataLayer

ThreadSafeDataLayer

XpoDefault Class

XpoDefault Members

DevExpress.Xpo Namespace