Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / Odbc / OdbcEnvironment.cs / 1 / OdbcEnvironment.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Data; using System.Data.Common; using System.Threading; namespace System.Data.Odbc { sealed internal class OdbcEnvironment { static private object _globalEnvironmentHandle; static private object _globalEnvironmentHandleLock = new object(); private OdbcEnvironment () {} // default const. static internal OdbcEnvironmentHandle GetGlobalEnvironmentHandle() { OdbcEnvironmentHandle globalEnvironmentHandle = _globalEnvironmentHandle as OdbcEnvironmentHandle; if(null == globalEnvironmentHandle) { ADP.CheckVersionMDAC(true); lock(_globalEnvironmentHandleLock) { globalEnvironmentHandle = _globalEnvironmentHandle as OdbcEnvironmentHandle; if(null == globalEnvironmentHandle) { globalEnvironmentHandle = new OdbcEnvironmentHandle(); _globalEnvironmentHandle = globalEnvironmentHandle; } } } return globalEnvironmentHandle; } static internal void ReleaseObjectPool() { object globalEnvironmentHandle = Interlocked.Exchange(ref _globalEnvironmentHandle, null); if(null != globalEnvironmentHandle) { (globalEnvironmentHandle as OdbcEnvironmentHandle).Dispose(); // internally refcounted so will happen correctly } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Data; using System.Data.Common; using System.Threading; namespace System.Data.Odbc { sealed internal class OdbcEnvironment { static private object _globalEnvironmentHandle; static private object _globalEnvironmentHandleLock = new object(); private OdbcEnvironment () {} // default const. static internal OdbcEnvironmentHandle GetGlobalEnvironmentHandle() { OdbcEnvironmentHandle globalEnvironmentHandle = _globalEnvironmentHandle as OdbcEnvironmentHandle; if(null == globalEnvironmentHandle) { ADP.CheckVersionMDAC(true); lock(_globalEnvironmentHandleLock) { globalEnvironmentHandle = _globalEnvironmentHandle as OdbcEnvironmentHandle; if(null == globalEnvironmentHandle) { globalEnvironmentHandle = new OdbcEnvironmentHandle(); _globalEnvironmentHandle = globalEnvironmentHandle; } } } return globalEnvironmentHandle; } static internal void ReleaseObjectPool() { object globalEnvironmentHandle = Interlocked.Exchange(ref _globalEnvironmentHandle, null); if(null != globalEnvironmentHandle) { (globalEnvironmentHandle as OdbcEnvironmentHandle).Dispose(); // internally refcounted so will happen correctly } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DBSqlParser.cs
- SimpleNameService.cs
- XmlFormatExtensionAttribute.cs
- SafeNativeMethodsCLR.cs
- _WinHttpWebProxyDataBuilder.cs
- AssemblyBuilder.cs
- MetabaseServerConfig.cs
- SqlProviderServices.cs
- ChannelPool.cs
- NetTcpBindingCollectionElement.cs
- ContentType.cs
- StandardBindingCollectionElement.cs
- SelectionWordBreaker.cs
- StreamUpdate.cs
- WindowsToolbarAsMenu.cs
- HtmlElement.cs
- PackagePart.cs
- DemultiplexingDispatchMessageFormatter.cs
- CodeCastExpression.cs
- DateTimeUtil.cs
- SectionUpdates.cs
- SqlParameter.cs
- ThrowHelper.cs
- EdmRelationshipRoleAttribute.cs
- Typography.cs
- BufferedGraphicsManager.cs
- BaseParagraph.cs
- BinHexEncoder.cs
- JsonReader.cs
- __Error.cs
- StylusPlugin.cs
- UnsafeNativeMethodsMilCoreApi.cs
- ContentPlaceHolder.cs
- TransportReplyChannelAcceptor.cs
- RtfToken.cs
- SecurityToken.cs
- ServicePointManager.cs
- SystemNetworkInterface.cs
- CommandLineParser.cs
- CodeSnippetCompileUnit.cs
- DWriteFactory.cs
- CacheSection.cs
- QilParameter.cs
- _OverlappedAsyncResult.cs
- IdnMapping.cs
- GenericPrincipal.cs
- AlphabeticalEnumConverter.cs
- _KerberosClient.cs
- CompilerInfo.cs
- PagesChangedEventArgs.cs
- ProcessThreadCollection.cs
- ButtonField.cs
- oledbconnectionstring.cs
- RsaKeyIdentifierClause.cs
- StylusLogic.cs
- XmlElementCollection.cs
- PackageDigitalSignature.cs
- ConsoleKeyInfo.cs
- CodeTypeConstructor.cs
- RootNamespaceAttribute.cs
- UiaCoreApi.cs
- TouchPoint.cs
- MetabaseSettingsIis7.cs
- FormattedTextSymbols.cs
- ContentHostHelper.cs
- newinstructionaction.cs
- Pool.cs
- TransformedBitmap.cs
- SQLCharsStorage.cs
- ColorInterpolationModeValidation.cs
- InvalidAsynchronousStateException.cs
- LogReserveAndAppendState.cs
- DataColumnCollection.cs
- ObjectSet.cs
- DiscreteKeyFrames.cs
- ControlUtil.cs
- SettingsPropertyIsReadOnlyException.cs
- DrawingImage.cs
- WaitingCursor.cs
- XmlAttributeOverrides.cs
- InputDevice.cs
- TypedElement.cs
- SessionKeyExpiredException.cs
- ClientCultureInfo.cs
- RepeatButton.cs
- SystemResourceHost.cs
- RegexStringValidator.cs
- RecommendedAsConfigurableAttribute.cs
- Model3D.cs
- ComponentResourceKey.cs
- DoubleCollectionConverter.cs
- RoutedEventHandlerInfo.cs
- CroppedBitmap.cs
- DBCSCodePageEncoding.cs
- LinqDataSourceContextData.cs
- FormViewRow.cs
- Selection.cs
- HttpPostedFile.cs
- RtfToXamlLexer.cs
- Registry.cs