Skip to main content
All docs
V24.1

MongoDBDataSourceBase.ConfigureDataConnection Event

Allows you to configure connection settings for a MongoDB instance.

Namespace: DevExpress.DataAccess.MongoDB

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

public event ConfigureDataConnectionEventHandler ConfigureDataConnection

Event Data

The ConfigureDataConnection event's data class is DevExpress.DataAccess.MongoDB.ConfigureDataConnectionEventArgs.

Remarks

A class Fill method call raises the ConfigureDataConnection event. The event occurs only if the class ConnectionParameters property is specified. Handle this event to change connection parameters before the connection to a MongoDB instance is established.

Example

The example below demonstrates how to handle the ConfigureDataConnection event to change connection parameters before a connection to a MongoDB instance is established.

using using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.MongoDB;
//...

private void mongoDBDataSource1_ConfigureDataConnection(object sender, ConfigureDataConnectionEventArgs e) {
    (e.ConnectionParameters as MongoDBCustomConnectionParameters).ConnectionString = "mongodb://localhost:27017";
}
See Also