Esempio n. 1
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed || !disposing)
            {
                return;
            }

            _connection.Close();
            _connection.Dispose();
            ((IDisposable)_dbcCreator).Dispose();

            try {
                if (!string.IsNullOrEmpty(_dbcCreator.DbcPath) && File.Exists(_dbcCreator.DbcPath))
                {
#if !DEBUG
                    Directory.Delete(Path.GetDirectoryName(_dbcCreator.DbcPath), true);
#endif
                }
            }
            catch (IOException ex) {
                VfpClientTracing.Tracer.TraceError(ex);
            }

            _disposed = true;
        }
Esempio n. 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (!disposing || _connection == null)
            {
                return;
            }

            if (_connection.State == ConnectionState.Open)
            {
                _connection.Close();
            }

            _connection.Dispose();
        }