/// <inheritdoc />
        protected override void Dispose(bool disposing)
        {
            Logger.LogPerformanceCounter(
                "SpannerDataReader.ActiveCount",
                () => Interlocked.Decrement(ref s_readerCount));

            _resultSet?.Dispose();
            _connectionToClose?.Close();
            _txToClose?.Dispose();
            base.Dispose(disposing);
        }
Exemple #2
0
        /// <summary>
        /// Common code used by both Dispose and Close. Dispose can't call Close, as it's not
        /// present in .NET Standard 1.5; Close can't call dispose as we don't want to call into
        /// the base Dispose method.
        /// </summary>
        private void CloseImpl()
        {
            lock (_lock)
            {
                if (_closed)
                {
                    return;
                }
                _closed = true;
                Logger.LogPerformanceCounter(
                    "SpannerDataReader.ActiveCount",
                    () => Interlocked.Decrement(ref s_readerCount));

                _resultSet?.Dispose();
                _resourceToClose?.Dispose();
            }
        }