#pragma warning restore 1591 //------------------------------------------------------------------------------ // // Method: Dispose // //------------------------------------------------------------------------------ /// <summary> /// Provides a method to free unmanaged resources used by this class. /// </summary> /// <param name="disposing">Whether the method is being called as part of an explicit Dispose routine, and hence whether managed resources should also be freed.</param> protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { // Free other state (managed objects). if (loggerImplementation != null) { loggerImplementation.Dispose(); loggerImplementation = null; } } // Free your own state (unmanaged objects). // Set large fields to null. disposed = true; } }
//------------------------------------------------------------------------------ // // Method: MicrosoftAccessMetricLogger (constructor) // //------------------------------------------------------------------------------ /// <summary> /// Initialises a new instance of the ApplicationMetrics.MicrosoftAccessMetricLogger class. Note this is an additional constructor to facilitate unit tests, and should not be used to instantiate the class under normal conditions. /// </summary> /// <param name="databaseFilePath">The full path to the Microsoft Access data file.</param> /// <param name="metricCategoryName">The name of the category which the metric events should be logged under in the database.</param> /// <param name="bufferProcessingStrategy">Object which implements a processing strategy for the buffers (queues).</param> /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param> /// <param name="dbConnection">A test (mock) database connection object.</param> /// <param name="dbCommand">A test (mock) database command object.</param> /// <param name="dateTime">A test (mock) DateTime object.</param> /// <param name="exceptionHandler">A test (mock) exception handler object.</param> public MicrosoftAccessMetricLogger(string databaseFilePath, string metricCategoryName, IBufferProcessingStrategy bufferProcessingStrategy, bool intervalMetricChecking, IOleDbConnection dbConnection, IOleDbCommand dbCommand, IDateTime dateTime, IExceptionHandler exceptionHandler) { loggerImplementation = new MicrosoftAccessMetricLoggerImplementation(databaseFilePath, metricCategoryName, bufferProcessingStrategy, intervalMetricChecking, dbConnection, dbCommand, dateTime, exceptionHandler); }
//------------------------------------------------------------------------------ // // Method: MicrosoftAccessMetricLogger (constructor) // //------------------------------------------------------------------------------ /// <summary> /// Initialises a new instance of the ApplicationMetrics.MicrosoftAccessMetricLogger class. /// </summary> /// <param name="databaseFilePath">The full path to the Microsoft Access data file.</param> /// <param name="metricCategoryName">The name of the category which the metric events should be logged under in the database.</param> /// <param name="bufferProcessingStrategy">Object which implements a processing strategy for the buffers (queues).</param> /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param> public MicrosoftAccessMetricLogger(string databaseFilePath, string metricCategoryName, IBufferProcessingStrategy bufferProcessingStrategy, bool intervalMetricChecking) { loggerImplementation = new MicrosoftAccessMetricLoggerImplementation(databaseFilePath, metricCategoryName, bufferProcessingStrategy, intervalMetricChecking); }
//------------------------------------------------------------------------------ // // Method: MicrosoftAccessMetricLogger (constructor) // //------------------------------------------------------------------------------ /// <summary> /// Initialises a new instance of the ApplicationMetrics.MicrosoftAccessMetricLogger class. /// </summary> /// <remarks>This constructor defaults to using the LoopingWorkerThreadBufferProcessor as the buffer processing strategy, and is maintained for backwards compatibility.</remarks> /// <param name="databaseFilePath">The full path to the Microsoft Access data file.</param> /// <param name="metricCategoryName">The name of the category which the metric events should be logged under in the database.</param> /// <param name="dequeueOperationLoopInterval">The time to wait (in milliseconds) between iterations of the worker thread which dequeues metric events and writes them to the Access database.</param> /// <param name="intervalMetricChecking">Specifies whether an exception should be thrown if the correct order of interval metric logging is not followed (e.g. End() method called before Begin()).</param> public MicrosoftAccessMetricLogger(string databaseFilePath, string metricCategoryName, int dequeueOperationLoopInterval, bool intervalMetricChecking) { loggerImplementation = new MicrosoftAccessMetricLoggerImplementation(databaseFilePath, metricCategoryName, new LoopingWorkerThreadBufferProcessor(dequeueOperationLoopInterval, false), intervalMetricChecking); }