private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (_trace != null) { _trace.OnEvent -= OnTraceEventInternal; _trace?.Drop(); _trace?.Dispose(); _trace = null; } _connection?.Dispose(); _connection = null; _server?.Disconnect(); _server?.Dispose(); _server = null; if (_startingTimer != null) { _startingTimer.Stop(); _startingTimer.Elapsed -= OnTimerElapsed; _startingTimer.Dispose(); _startingTimer = null; } } disposedValue = true; } }
//private void ServerPing() //{ // _server.StartXmlaRequest(ExcelAmo.Microsoft.AnalysisServices.XmlaRequestType.Execute); // _server.EndXmlaRequest(); //} private xlAmo.Trace GetTrace() { if (_trace == null) { Log.Debug("{class} {method} {event}", "QueryTraceEngineExcel", "GetTrace", "about to create new trace"); _server = new xlAmo.Server(); _server.Connect(_connectionString); _trace = _server.Traces.Add(string.Format("DaxStudio_Trace_SPID_{0}", _sessionId)); _trace.Filter = GetSessionIdFilter(_sessionId); // set default stop time in case trace gets disconnected //_trace.StopTime = DateTime.UtcNow.AddHours(24); Log.Debug("{class} {method} {event}", "QueryTraceEngineExcel", "GetTrace", "created new trace"); } return(_trace); }
private xlAmo.Trace GetTrace() { if (_trace == null) { _server = new xlAmo.Server(); _server.Connect(_connectionString); _trace = _server.Traces.Add( string.Format("DaxStudio_Trace_SPID_{0}", _sessionId)); _trace.Filter = GetSessionIdFilter(_sessionId); _trace.OnEvent += OnTraceEventInternal; } return _trace; }