Skip to main content
.NET 6.0+

XpoDefault.GetConnectionProvider(AutoCreateOption) Method

Creates a data store provider (an IDataStore instance).

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

public static IDataStore GetConnectionProvider(
    AutoCreateOption defaultAutoCreateOption
)

Parameters

Name Type Description
defaultAutoCreateOption AutoCreateOption

Specifies whether XPO can create a database or update its schema.

Returns

Type Description
IDataStore

A data store provider.

Remarks

Uses the ActiveConnectionString property to retrieve the database connection settings.

Example

This example shows how to use the ActiveConnectionString property to create a SimpleDataLayer instance.

using DevExpress.Xpo;
using DevExpress.Xpo.DB;

//...

SimpleDataLayer dataLayer = new SimpleDataLayer(
    XpoDefault.GetConnectionProvider(AutoCreateOption.DatabaseAndSchema));
See Also