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

XpoDefault.GetDataLayer(IDbConnection, XPDictionary, AutoCreateOption) Method

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v19.2.dll

Declaration

public static IDataLayer GetDataLayer(
    IDbConnection connection,
    XPDictionary dictionary,
    AutoCreateOption autoCreateOption
)

Parameters

Name Type Description
connection IDbConnection

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.

Returns

Type Description
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 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