Esempio n. 1
0
 private void Exit(string message)
 {
     _eventLog.WriteEntry(message, EventLogEntryType.Error);
     _thread = null;
     _instance = null;
     InvokeStopping(new SqlTraceService.StoppingEventArgs { Reason = message });
 }
Esempio n. 2
0
        private void Term()
        {
            if (_termHandle != null) _termHandle.Set();
            if (_thread != null) _thread.Join();
            _thread = null;

            foreach (var database in GetDatabases())
            {
                try
                {
                    var conn = new SqlConnection(database.Value.InstanceConnectionString);
                    var server = new Server(new ServerConnection(conn));
                    var result = server.ConnectionContext.ExecuteNonQuery(string.Format(StopScript, _workDirectory));
                }
                catch
                {
                }
            }

            _instance = null;
        }
Esempio n. 3
0
 public static void Start(EventLog eventLog, string workDirectory)
 {
     if (_instance == null) _instance = new SqlTraceManager(eventLog, workDirectory);
 }