Skip to main content
A newer version of this page is available. .

DataStoreLogger Class

Enables operations performed by a specific IDataStore object to be logged.

Namespace: DevExpress.Xpo.DB

Assembly: DevExpress.Data.v19.2.dll

Declaration

public class DataStoreLogger :
    DataStoreSerialized,
    ICommandChannel,
    ICommandChannelAsync

Remarks

The DataStoreLogger class allows you to log data-aware operations performed by a specific IDataStore object (for instance, for debug purposes). The IDataStore object, whose operations should be tracked, must be passed to the DataStoreLogger constructor.

Example

The following example demonstrates how to log operations performed by a specific connection provider. To log operations, a new instance of the DataStoreLogger class is used. The operations are logged in a “myLog.log” file.

using System.IO;
using DevExpress.Xpo;
using DevExpress.Xpo.DB;

static void Main() {         
   using(StreamWriter writer = new StreamWriter("myLog.log")) {
      // Get the default connection provider. 
      // All the operations performed by this provider will be logged.
      IDataStore trackedDataStore = 
        XpoDefault.GetConnectionProvider(AutoCreateOption.DatabaseAndSchema);
      // Create a logger that will track the default provider's behavior.
      DataStoreLogger logger = new DataStoreLogger(trackedDataStore, writer);
      // Create a data layer and bind it to the logger. 
      // Assign it to the XPODefault.DataLayer.
      // A Session will then use this data layer(and so a logger) 
      // when a connection to a data store should be established.
      XpoDefault.DataLayer = new SimpleDataLayer(logger);
      Application.Run(new Form1());
   }
}

Inheritance

Object
MarshalByRefObject
DevExpress.Xpo.DB.DataStoreSerializedBase
DevExpress.Xpo.DB.DataStoreSerialized
DataStoreLogger
See Also