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
- _SecureChannel.cs
- FontStyles.cs
- SiteMapNode.cs
- UmAlQuraCalendar.cs
- DateTimeConstantAttribute.cs
- MetadataSerializer.cs
- WebPartVerbCollection.cs
- ScrollViewer.cs
- LinkedList.cs
- ExpandSegment.cs
- CommandLibraryHelper.cs
- ConfigViewGenerator.cs
- CodeDomSerializerException.cs
- HtmlInputRadioButton.cs
- GeometryModel3D.cs
- TraceData.cs
- UrlMappingCollection.cs
- PopOutPanel.cs
- ArrayTypeMismatchException.cs
- InfiniteTimeSpanConverter.cs
- DataServiceRequestOfT.cs
- XmlNotation.cs
- MouseWheelEventArgs.cs
- XmlTextReaderImpl.cs
- IsolationInterop.cs
- DocumentAutomationPeer.cs
- ExpressionBuilder.cs
- XD.cs
- ContentPosition.cs
- SliderAutomationPeer.cs
- SectionInformation.cs
- SharedPerformanceCounter.cs
- WebBaseEventKeyComparer.cs
- Encoder.cs
- RoleServiceManager.cs
- Color.cs
- XpsFixedPageReaderWriter.cs
- CellConstant.cs
- SecurityRuntime.cs
- PTUtility.cs
- CrossSiteScriptingValidation.cs
- BufferModesCollection.cs
- DispatcherFrame.cs
- ReturnValue.cs
- LocationUpdates.cs
- StringComparer.cs
- GlyphRun.cs
- BitmapEffectDrawingContent.cs
- InternalsVisibleToAttribute.cs
- AppDomainProtocolHandler.cs
- SoapSchemaImporter.cs
- XslAstAnalyzer.cs
- IApplicationTrustManager.cs
- GridViewPageEventArgs.cs
- LessThanOrEqual.cs
- SiblingIterators.cs
- DataGridPagerStyle.cs
- __ComObject.cs
- DisplayMemberTemplateSelector.cs
- COAUTHIDENTITY.cs
- OdbcCommand.cs
- HiddenField.cs
- TextEndOfParagraph.cs
- XPathNodePointer.cs
- CaseInsensitiveComparer.cs
- filewebresponse.cs
- PathFigureCollection.cs
- ActivityBuilderXamlWriter.cs
- ToolStripSettings.cs
- Task.cs
- PopOutPanel.cs
- Pair.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- StrongNamePublicKeyBlob.cs
- Dynamic.cs
- ServiceNameElementCollection.cs
- CqlGenerator.cs
- XmlTextReaderImpl.cs
- FontStyle.cs
- IsolatedStorage.cs
- ClientApiGenerator.cs
- XmlBinaryReader.cs
- SchemaInfo.cs
- New.cs
- ColorAnimation.cs
- ProfileInfo.cs
- Sentence.cs
- EdmPropertyAttribute.cs
- Serializer.cs
- SrgsElementList.cs
- DataGridTable.cs
- XmlSchemaAppInfo.cs
- HtmlInputText.cs
- ProtectedConfigurationSection.cs
- ContextMenuStrip.cs
- Effect.cs
- BaseTemplateParser.cs
- ConfigurationErrorsException.cs
- SizeAnimationClockResource.cs
- Menu.cs