Example T1172376
Visible to All Users

Reporting for WinForms - Override the Default Isolation Level

This example overrides the default isolation level (READ COMMITTED) for a specific query. It allows users to retrieve information without being locked by another process that modifies the same data.

Example Overview

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

Files to Review

More Examples

Reporting for ASP NET.Core - Implement Row-Level Security

Documentation

Example Code

XtraReportApp/Form1.cs(vb)
C#
using DevExpress.DataAccess.Sql; using System; namespace XtraReportApp { public partial class Form1 : DevExpress.XtraEditors.XtraForm { public Form1() { InitializeComponent(); reportDesigner1.AddService(typeof(IDBCommandInterceptor), new NolockInterceptor()); } private void Form1_Load(object sender, EventArgs e) { reportDesigner1.OpenReport(new XtraReport1()); } } }
XtraReportApp/NolockInterceptor.cs(vb)
C#
using DevExpress.DataAccess.Sql; using System.Data; namespace XtraReportApp { internal class NolockInterceptor : IDBCommandInterceptor { public void CommandCreated(string queryName, IDbCommand command) { command.CommandText += " WITH (NOLOCK)"; } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.