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
- MatrixValueSerializer.cs
- WebServicesDescriptionAttribute.cs
- FormViewUpdateEventArgs.cs
- XmlSerializerAssemblyAttribute.cs
- PolyQuadraticBezierSegment.cs
- EnumMemberAttribute.cs
- VerificationAttribute.cs
- AdapterDictionary.cs
- StateWorkerRequest.cs
- ButtonFlatAdapter.cs
- SendActivityValidator.cs
- PipelineDeploymentState.cs
- pingexception.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- DataGridCommandEventArgs.cs
- Composition.cs
- BuildResult.cs
- ToolStripPanelCell.cs
- ScriptResourceHandler.cs
- MessageQueueException.cs
- Utils.cs
- RemotingSurrogateSelector.cs
- BulletedList.cs
- EntityClientCacheKey.cs
- DesignerVerbCollection.cs
- CharacterShapingProperties.cs
- PassportPrincipal.cs
- UInt32.cs
- DefaultBinder.cs
- AttributeProviderAttribute.cs
- ProfileGroupSettingsCollection.cs
- AutomationPattern.cs
- Transform3DCollection.cs
- SqlStream.cs
- XmlSerializableWriter.cs
- SiteMembershipCondition.cs
- DataFormat.cs
- RoutedUICommand.cs
- CapacityStreamGeometryContext.cs
- DateTimeValueSerializer.cs
- ChildTable.cs
- GridToolTip.cs
- EntityDataSourceDataSelectionPanel.cs
- UIAgentAsyncBeginRequest.cs
- FileDetails.cs
- _Semaphore.cs
- Drawing.cs
- DbParameterHelper.cs
- ElapsedEventArgs.cs
- initElementDictionary.cs
- RelationshipType.cs
- SrgsGrammarCompiler.cs
- ControlUtil.cs
- EdmSchemaAttribute.cs
- GridItem.cs
- M3DUtil.cs
- PageCache.cs
- MarshalDirectiveException.cs
- BitmapEffectGeneralTransform.cs
- ReflectTypeDescriptionProvider.cs
- InvalidWMPVersionException.cs
- XomlCompilerHelpers.cs
- ExpressionNode.cs
- ConfigurationElementProperty.cs
- FileAuthorizationModule.cs
- CurrentChangingEventArgs.cs
- StreamUpdate.cs
- WebControlAdapter.cs
- Compensation.cs
- SqlProviderManifest.cs
- WebPartHeaderCloseVerb.cs
- SqlDataSourceCommandEventArgs.cs
- Overlapped.cs
- AttributeSetAction.cs
- FtpWebRequest.cs
- AnimationException.cs
- PropertyChangedEventManager.cs
- BrowserDefinitionCollection.cs
- GeneralTransformGroup.cs
- AppSecurityManager.cs
- ConfigurationException.cs
- PrimaryKeyTypeConverter.cs
- WebPartsPersonalizationAuthorization.cs
- StringValidator.cs
- MouseCaptureWithinProperty.cs
- FreezableDefaultValueFactory.cs
- CfgParser.cs
- DbTransaction.cs
- MasterPageParser.cs
- ClientTargetCollection.cs
- FocusManager.cs
- CollectionEditorDialog.cs
- ColumnMapVisitor.cs
- DispatcherObject.cs
- DecimalKeyFrameCollection.cs
- QueryConverter.cs
- InteropBitmapSource.cs
- AssemblySettingAttributes.cs
- BitConverter.cs
- uribuilder.cs