private void StartOperationThread() { try { ShutdownEvent = new ManualResetEvent(false); NewOperationEvent = new AutoResetEvent(false); ActiveOperationTable = new List <IActiveOperation>(); OperationThread = new Thread(new ThreadStart(ExecuteOperation)); OperationThread.Start(); } #if TRACE catch (ApplicationException) { throw; } #endif catch (Exception e) { if (IsDebugTraceEnabled) { Debugging.PrintExceptionMessage(e.Message); } OperationThread = null; } }
/// <summary> /// Initializes the database, loading the engine associated to <paramref name="connectorType"/>. /// </summary> /// <parameters> /// <param name="connectorType">The engine backing the database.</param> /// <param name="connectionOption">Options related to connection to a server.</param> /// <param name="isDebugTraceEnabled">True to turn traces on.</param> /// </parameters> public virtual void Initialize(ConnectorType connectorType, ConnectionOption connectionOption, bool isDebugTraceEnabled) { Debug.Assert(Connector == null); if (Connector != null) { return; } ConnectorType = connectorType; ConnectionOption = connectionOption; try { switch (ConnectorType) { case ConnectorType.MySql: Connector = new MySqlConnector(); break; default: throw new ArgumentOutOfRangeException(nameof(connectorType)); } IsDebugTraceEnabled = isDebugTraceEnabled; if (IsDebugTraceEnabled) { Debugging.Print("Connector created: " + Connector.ToString()); } } #if TRACE catch (ApplicationException) { throw; } #endif catch (Exception e) { if (IsDebugTraceEnabled) { Debugging.PrintExceptionMessage(e.Message); } } }