Back to Devexpress

XpoDefault.GetDataLayer(IDbConnection, AutoCreateOption) Method

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

latest2.9 KB
Original Source

XpoDefault.GetDataLayer(IDbConnection, AutoCreateOption) Method

Creates a data layer for the specified connection and the default metadata.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public static IDataLayer GetDataLayer(
    IDbConnection connection,
    AutoCreateOption autoCreateOption
)
vb
Public Shared Function GetDataLayer(
    connection As IDbConnection,
    autoCreateOption As AutoCreateOption
) As IDataLayer

Parameters

NameTypeDescription
connectionIDbConnection

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

| | autoCreateOption | AutoCreateOption |

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

|

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. The metadata information used to create the data layer is obtained via the XpoDefault.GetDictionary method.

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

When you have finished working with a data layer you need to dispose of it to release the resources allocated by the data layer.

See Also

DataLayer

SimpleDataLayer

ThreadSafeDataLayer

XpoDefault Class

XpoDefault Members

DevExpress.Xpo Namespace