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
- SmtpClient.cs
- XmlSchemaType.cs
- DrawListViewColumnHeaderEventArgs.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- PreviewPageInfo.cs
- DataPagerCommandEventArgs.cs
- TraceProvider.cs
- FileUtil.cs
- TextSelectionHighlightLayer.cs
- HyperLinkStyle.cs
- XmlILCommand.cs
- CustomLineCap.cs
- LinearGradientBrush.cs
- TrailingSpaceComparer.cs
- DeviceContexts.cs
- BamlResourceSerializer.cs
- InvalidDataException.cs
- ValidationHelper.cs
- UntypedNullExpression.cs
- CodeSnippetTypeMember.cs
- DataGridViewRow.cs
- EntityClassGenerator.cs
- HttpListenerResponse.cs
- MultiPropertyDescriptorGridEntry.cs
- ErrorStyle.cs
- SecurityTokenAuthenticator.cs
- UIElement3D.cs
- CryptoStream.cs
- TypeGenericEnumerableViewSchema.cs
- CqlErrorHelper.cs
- HttpConfigurationSystem.cs
- ExpressionParser.cs
- SchemaExporter.cs
- HttpRuntimeSection.cs
- EntityDataSourceContextCreatedEventArgs.cs
- MethodBuilder.cs
- StackOverflowException.cs
- SecurityHeader.cs
- ApplicationException.cs
- GlyphRunDrawing.cs
- ActionItem.cs
- Types.cs
- TypeGeneratedEventArgs.cs
- SmtpMail.cs
- TextServicesPropertyRanges.cs
- PropertyRef.cs
- WebServiceEnumData.cs
- FrameworkContentElement.cs
- QilParameter.cs
- ComboBoxAutomationPeer.cs
- SystemIcmpV6Statistics.cs
- FlowDocumentScrollViewer.cs
- StylusEditingBehavior.cs
- ObjectItemCollection.cs
- CategoryNameCollection.cs
- QuaternionAnimation.cs
- Rules.cs
- ZipPackage.cs
- Internal.cs
- ThreadAttributes.cs
- InstanceHandleConflictException.cs
- EventLogStatus.cs
- SaveWorkflowAsyncResult.cs
- EnglishPluralizationService.cs
- CustomWebEventKey.cs
- PointLight.cs
- KeyTimeConverter.cs
- DescendantBaseQuery.cs
- SmiContext.cs
- DbConnectionPoolCounters.cs
- Roles.cs
- CodeParameterDeclarationExpression.cs
- ClientProxyGenerator.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- RoutingService.cs
- CodeMemberProperty.cs
- InteropBitmapSource.cs
- AnnotationComponentChooser.cs
- IDispatchConstantAttribute.cs
- TypeNameConverter.cs
- ParsedAttributeCollection.cs
- SqlReorderer.cs
- ServerIdentity.cs
- IntellisenseTextBox.designer.cs
- CompiledIdentityConstraint.cs
- ParameterCollection.cs
- HealthMonitoringSectionHelper.cs
- AuthenticationException.cs
- TextTreeTextNode.cs
- EntityCommandDefinition.cs
- TargetConverter.cs
- OperationCanceledException.cs
- ThreadStateException.cs
- ClipboardProcessor.cs
- XmlCharacterData.cs
- SqlUserDefinedAggregateAttribute.cs
- InterleavedZipPartStream.cs
- HttpStreamXmlDictionaryReader.cs
- DocumentPageView.cs
- MatrixValueSerializer.cs