Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- StringExpressionSet.cs
- FileLevelControlBuilderAttribute.cs
- DocumentOrderComparer.cs
- Figure.cs
- PassportAuthenticationEventArgs.cs
- AddingNewEventArgs.cs
- RenderDataDrawingContext.cs
- OperationAbortedException.cs
- DataTableExtensions.cs
- baseshape.cs
- TransactionTraceIdentifier.cs
- ReflectPropertyDescriptor.cs
- PopupEventArgs.cs
- CompressEmulationStream.cs
- ProxyFragment.cs
- HttpContextWrapper.cs
- _ChunkParse.cs
- UnknownBitmapDecoder.cs
- SchemaElement.cs
- ReadOnlyObservableCollection.cs
- ListSortDescription.cs
- DirectoryNotFoundException.cs
- ServicePointManager.cs
- APCustomTypeDescriptor.cs
- IISUnsafeMethods.cs
- _NetRes.cs
- ScriptResourceAttribute.cs
- basecomparevalidator.cs
- StructuralComparisons.cs
- UnauthorizedAccessException.cs
- OptionUsage.cs
- Listbox.cs
- TTSEngineProxy.cs
- InternalDispatchObject.cs
- NewArray.cs
- BaseTemplateParser.cs
- ContentFilePart.cs
- ContractReference.cs
- Metafile.cs
- ViewStateException.cs
- Conditional.cs
- DBDataPermissionAttribute.cs
- _DigestClient.cs
- TableCell.cs
- MatchingStyle.cs
- SafeProcessHandle.cs
- NetWebProxyFinder.cs
- IssuanceLicense.cs
- SmtpNetworkElement.cs
- Vector.cs
- HttpRequestCacheValidator.cs
- CharacterHit.cs
- EmptyCollection.cs
- BamlLocalizer.cs
- FilePrompt.cs
- UrlPath.cs
- PropertyCollection.cs
- ValidatorCompatibilityHelper.cs
- DictationGrammar.cs
- OpCodes.cs
- AutomationFocusChangedEventArgs.cs
- GeneralTransformGroup.cs
- ApplicationDirectory.cs
- ClientProtocol.cs
- BufferedResponseStream.cs
- PenLineCapValidation.cs
- InfiniteIntConverter.cs
- DynamicObjectAccessor.cs
- bidPrivateBase.cs
- MouseActionConverter.cs
- RenamedEventArgs.cs
- PropertyStore.cs
- SimpleParser.cs
- Comparer.cs
- OrElse.cs
- PageBreakRecord.cs
- TypeRefElement.cs
- MenuCommands.cs
- ObjectStateManagerMetadata.cs
- SwitchElementsCollection.cs
- SchemaAttDef.cs
- SpellerInterop.cs
- SqlRewriteScalarSubqueries.cs
- StandardToolWindows.cs
- BooleanAnimationBase.cs
- Compensation.cs
- HyperLinkStyle.cs
- DateTimePicker.cs
- LinkAreaEditor.cs
- TreeView.cs
- SQLBinaryStorage.cs
- StoreItemCollection.Loader.cs
- FixedFindEngine.cs
- CodeDirectoryCompiler.cs
- ProfileService.cs
- UnmanagedMarshal.cs
- TreeWalkHelper.cs
- MdImport.cs
- Configuration.cs
- Calendar.cs