Back to Devexpress

XpoDefault.GetConnectionProvider(IDbConnection, AutoCreateOption) Method

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

latest2.8 KB
Original Source

XpoDefault.GetConnectionProvider(IDbConnection, AutoCreateOption) Method

Creates a data store provider (an IDataStore instance).

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public static IDataStore GetConnectionProvider(
    IDbConnection connection,
    AutoCreateOption autoCreateOption
)
vb
Public Shared Function GetConnectionProvider(
    connection As IDbConnection,
    autoCreateOption As AutoCreateOption
) As IDataStore

Parameters

NameTypeDescription
connectionIDbConnection

A database connection object.

| | autoCreateOption | AutoCreateOption |

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

|

Returns

TypeDescription
IDataStore

A data store provider.

|

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetConnectionProvider(IDbConnection, 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.

XPO_how-to-generate-persistent-metadata-for-an-arbitrary-data-table-e2922/CS/MapArbitraryDatabaseExample/Program.cs#L27

csharp
static void InitializeDataLayer(IDbConnection connection) {
    ConnectionProviderSql prov = (ConnectionProviderSql)XpoDefault.GetConnectionProvider(connection, AutoCreateOption.None);
    XPDictionary dict = new ReflectionDictionary();

See Also

XpoDefault Class

XpoDefault Members

DevExpress.Xpo Namespace