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
- IndentedTextWriter.cs
- Validator.cs
- SqlTypesSchemaImporter.cs
- sqlnorm.cs
- RadioButtonStandardAdapter.cs
- XmlDictionaryString.cs
- TickBar.cs
- TraversalRequest.cs
- PhonemeEventArgs.cs
- GeometryModel3D.cs
- ColumnWidthChangedEvent.cs
- EventLog.cs
- XmlFormatReaderGenerator.cs
- MinMaxParagraphWidth.cs
- XmlLangPropertyAttribute.cs
- MouseGestureConverter.cs
- FamilyMap.cs
- ZipIOLocalFileHeader.cs
- Substitution.cs
- CorrelationKeyCalculator.cs
- Nodes.cs
- ConfigXmlCDataSection.cs
- XPathNodePointer.cs
- PrincipalPermission.cs
- GiveFeedbackEventArgs.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- TypefaceCollection.cs
- GraphicsState.cs
- Geometry.cs
- _KerberosClient.cs
- XmlSchemaSimpleType.cs
- DependencySource.cs
- EncoderBestFitFallback.cs
- DataGridViewToolTip.cs
- XhtmlTextWriter.cs
- ServiceCredentialsElement.cs
- CaseInsensitiveOrdinalStringComparer.cs
- DetailsViewUpdateEventArgs.cs
- MetadataItemSerializer.cs
- SplitterEvent.cs
- XmlAttributeAttribute.cs
- TextureBrush.cs
- ToolBarButton.cs
- NullableIntSumAggregationOperator.cs
- LinqDataSourceView.cs
- UTF32Encoding.cs
- MILUtilities.cs
- DesignerVerbCollection.cs
- ExceptionWrapper.cs
- QuaternionValueSerializer.cs
- CodeVariableDeclarationStatement.cs
- StandardToolWindows.cs
- HandlerMappingMemo.cs
- WCFServiceClientProxyGenerator.cs
- SimpleFieldTemplateUserControl.cs
- Missing.cs
- RoleServiceManager.cs
- CreatingCookieEventArgs.cs
- SiteMapDesignerDataSourceView.cs
- AutoCompleteStringCollection.cs
- NegatedCellConstant.cs
- LinkedDataMemberFieldEditor.cs
- IEnumerable.cs
- AffineTransform3D.cs
- Buffer.cs
- GuidelineSet.cs
- PenThreadWorker.cs
- CorrelationManager.cs
- ToolStripDropDownDesigner.cs
- EntityConnection.cs
- UIEndRequest.cs
- Subtract.cs
- RegexStringValidatorAttribute.cs
- GridItemProviderWrapper.cs
- XmlSerializerNamespaces.cs
- fixedPageContentExtractor.cs
- DataBindingList.cs
- TrustExchangeException.cs
- CodeSnippetCompileUnit.cs
- XmlDownloadManager.cs
- XmlnsCompatibleWithAttribute.cs
- DataPagerFieldItem.cs
- EventProxy.cs
- TextDecorationCollection.cs
- IHttpResponseInternal.cs
- IssuedSecurityTokenProvider.cs
- TextTrailingWordEllipsis.cs
- ReaderWriterLockWrapper.cs
- MultiByteCodec.cs
- ToolStrip.cs
- Propagator.JoinPropagator.cs
- SqlMethodAttribute.cs
- AttachedProperty.cs
- CancellationScope.cs
- CollectionAdapters.cs
- RowSpanVector.cs
- ZipPackage.cs
- FontResourceCache.cs
- AppDomainFactory.cs
- isolationinterop.cs