Special component LinqMonitor is used for monitoring of the application interaction with database. It allows you to print trace messages to any output stream and use the dbMonitor tool for trace viewing. LinqMonitor offers you a possibility to monitor your database operations from DataContext. It can be used for any kind of applications – desktop, ASP.NET and windows services.
To start monitoring do the following steps:
- Create an instance of the LinqMonitor class
- Set the IsActive property to true
- Add the handler to the TraceEvent of the LinqMonitor class instance
- Use the Description and ExtraInfo properties of the MonitorEventArgs class to get an information about database operations
The following example shows you how to use LinqMonitor:
The output of this sample is listed below:
Description: Open connection: "User ID=CRM_DEMO;Password=CRM_DEMO;SERVER=DB;"
Extra info: User ID=CRM_DEMO;Password=CRM_DEMO;SERVER=DB;;
Description: Execute: SELECT t1."CompanyID", t1."CompanyName", t1."PrimaryContact", t1."Web", t1."Email", t1."AddressTitle", t1."Address", t1."City", t1."Region", t1."PostalCode", t1."Country", t1."Phone", t1."Fax" FROM CRM_DEMO."Company" t1
Extra info: -1
Borland UK CodeGear Division Alpha Bank ... Orderbase Consulting Gmbh
Description: Disconnect
Extra info:
Monitoring capabilities are available at design-time as well. Just change the IsActive property to true and add a new handler on the Properties window.
Note: |
---|
Please note that the LinqMonitor doesn't support connection pool monitoring. To monitor connection pools install the Professional editions of the Devart data providers and use provider-specific monitors (OracleMonitor, MySqlMonitor, PgSqlMonitor, SQLiteMonitor). |