예제 #1
0
 private void Exit(string message)
 {
     _eventLog.WriteEntry(message, EventLogEntryType.Error);
     _thread = null;
     _instance = null;
     InvokeStopping(new SqlTraceService.StoppingEventArgs { Reason = message });
 }
예제 #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;
        }
예제 #3
0
 public static void Start(EventLog eventLog, string workDirectory)
 {
     if (_instance == null) _instance = new SqlTraceManager(eventLog, workDirectory);
 }