.NET Standard 2.0+
.NET Framework 4.5.2+
.NET Standard 2.0+

XpoDefault.ConnectionString Property

Gets or sets the string which is used to open a database, by default.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v20.2.dll

Declaration

public static string ConnectionString { get; set; }
Public Shared Property ConnectionString As String

Property Value

Type Description
String

A String value which specifies the parameters needed to establish the initial connection.

Remarks

Use the ConnectionString property to specify a connection string for the default Data Access Layer.

The default sessions and newly created sessions will use the specified connection string when they are connected to a data store, as shown in the following code example.

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

// Retrieve the MS Access database-specific connection string.
XpoDefault.ConnectionString =
    AccessConnectionProvider.GetConnectionString("sample.mdb", "user", "pwd");
// If the default session is connected, disconnect it.
// XpoDefault.Session and Session.DefaultSession can be used interchangeably.
if(XpoDefault.Session.IsConnected) {
    XpoDefault.Session.Disconnect();
}

// The default data access layer is created and connected to the database
// using the connection string.
XpoDefault.Session.Connect();
See Also