Skip to main content
All docs
V24.1

DashboardViewer.CustomDBCommandInterceptor Property

Specifies the IDBCommandInterceptor object for the Dashboard Viewer control.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v24.1.Win.dll

NuGet Package: DevExpress.Win.Dashboard

Declaration

[Browsable(false)]
[DefaultValue(null)]
public IDBCommandInterceptor CustomDBCommandInterceptor { get; set; }

Property Value

Type Default Description
IDBCommandInterceptor null

An IDBCommandInterceptor object.

Remarks

Dashboard controls execute a variety of SQL statements against the database. Implement IDBCommandInterceptor to intercept these data source commands. You can suppress a command or modify the execution algorithm.

Example: Dashboard for WinForms - Override the Default Isolation Level

The following example shows how to override the default isolation level (READ COMMITTED) in a specific query. The change allows users to retrieve information without being locked by another process that modifies the same data. This can significantly reduce the query time.

  1. Implement the IDBCommandInterceptor interface (NolockInterceptor.cs in this example). Call the IDBCommandInterceptor.CommandCreated(String, IDbCommand) method and specify CommandText to execute.

    using DevExpress.DataAccess.Sql;
    using System.Data;
    
    namespace WinDashboard {
        internal class NolockInterceptor : IDBCommandInterceptor {
            public void CommandCreated(string queryName, IDbCommand command) {
                command.CommandText += " WITH (NOLOCK)";
            }
        }
    }
    
  2. Assign the NolockInterceptor object to the CustomDBCommandInterceptor property.

    namespace WinDashboard {
        public partial class Form1 : Form {
            public Form1() {
                InitializeComponent();
                dashboardViewer.CustomDBCommandInterceptor = new NolockInterceptor();
                // ...
            }
        }
    }
    
See Also