Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / Odbc / OdbcEnvironment.cs / 1305376 / 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
- OutputWindow.cs
- DataSourceXmlAttributeAttribute.cs
- StateDesigner.TransitionInfo.cs
- DeflateStream.cs
- BindUriHelper.cs
- TemplateKey.cs
- GeneralTransform2DTo3DTo2D.cs
- TextContainerChangeEventArgs.cs
- Msmq4PoisonHandler.cs
- BindingGroup.cs
- GenerateScriptTypeAttribute.cs
- CheckBoxPopupAdapter.cs
- ThrowHelper.cs
- ControlParameter.cs
- XMLSyntaxException.cs
- XmlCustomFormatter.cs
- PropertyRef.cs
- RegionIterator.cs
- SqlCommand.cs
- BitmapEditor.cs
- PaintValueEventArgs.cs
- ProfileSettings.cs
- DataSetMappper.cs
- MetadataCache.cs
- SmtpAuthenticationManager.cs
- TextElementEnumerator.cs
- RulePatternOps.cs
- XmlSchemaSimpleContent.cs
- SerializationHelper.cs
- SingleAnimation.cs
- _SpnDictionary.cs
- HttpValueCollection.cs
- QueryableFilterUserControl.cs
- ByteAnimationUsingKeyFrames.cs
- SimplePropertyEntry.cs
- Image.cs
- GradientSpreadMethodValidation.cs
- ToolCreatedEventArgs.cs
- SrgsSubset.cs
- EditorReuseAttribute.cs
- SQLDateTime.cs
- SHA1Managed.cs
- CurrentTimeZone.cs
- OleServicesContext.cs
- httpapplicationstate.cs
- TraceSection.cs
- PerfService.cs
- InvalidPropValue.cs
- Codec.cs
- TranslateTransform3D.cs
- X509Chain.cs
- ParameterCollection.cs
- FormattedText.cs
- HTTPNotFoundHandler.cs
- DropShadowBitmapEffect.cs
- PopupEventArgs.cs
- CodeMemberField.cs
- SparseMemoryStream.cs
- NamespaceQuery.cs
- XamlInt32CollectionSerializer.cs
- EastAsianLunisolarCalendar.cs
- Registration.cs
- NetMsmqSecurityMode.cs
- DashStyle.cs
- SectionInformation.cs
- ICollection.cs
- Point.cs
- RsaKeyIdentifierClause.cs
- WebScriptMetadataInstanceContextProvider.cs
- FixedElement.cs
- IOException.cs
- TableLayoutStyleCollection.cs
- UserControl.cs
- WorkflowEnvironment.cs
- SyndicationContent.cs
- Accessible.cs
- ControlBindingsCollection.cs
- DataExchangeServiceBinder.cs
- SweepDirectionValidation.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- HttpProxyTransportBindingElement.cs
- ElementNotAvailableException.cs
- BindingWorker.cs
- HttpConfigurationContext.cs
- TextParagraphView.cs
- ToolboxItem.cs
- NotificationContext.cs
- FontSource.cs
- ProviderConnectionPoint.cs
- MemberDescriptor.cs
- SqlPersonalizationProvider.cs
- XmlSchemaValidator.cs
- SettingsAttributeDictionary.cs
- BaseConfigurationRecord.cs
- GorillaCodec.cs
- ToolboxDataAttribute.cs
- LocalizationComments.cs
- AVElementHelper.cs
- DataExpression.cs
- AspProxy.cs