Skip to main content
A newer version of this page is available. .

XpoDefault.GetDataLayer(String, XPDictionary, AutoCreateOption) Method

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v18.2.dll

Declaration

public static IDataLayer GetDataLayer(
    string connectionString,
    XPDictionary dictionary,
    AutoCreateOption defaultAutoCreateOption
)

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.

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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetDataLayer(String, XPDictionary, AutoCreateOption) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also