Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- ExternalDataExchangeService.cs
- PanelDesigner.cs
- Soap12ProtocolReflector.cs
- HttpRawResponse.cs
- ByteStorage.cs
- ListViewTableCell.cs
- ExtendedPropertyDescriptor.cs
- EFDataModelProvider.cs
- HotSpot.cs
- TextEndOfSegment.cs
- cookieexception.cs
- IList.cs
- WindowsIdentity.cs
- DynamicPropertyReader.cs
- BaseTemplateParser.cs
- SqlAliaser.cs
- MessageFormatterConverter.cs
- TemplateColumn.cs
- BinaryObjectInfo.cs
- SystemFonts.cs
- RelationshipFixer.cs
- LineServices.cs
- WindowsTitleBar.cs
- TimeSpanOrInfiniteValidator.cs
- DetailsViewInsertedEventArgs.cs
- UpdateCompiler.cs
- LinqDataSourceUpdateEventArgs.cs
- DataObjectAttribute.cs
- DES.cs
- HuffModule.cs
- ExceptionUtil.cs
- TreeViewDataItemAutomationPeer.cs
- NativeMethods.cs
- ObjectDataSourceDisposingEventArgs.cs
- PreparingEnlistment.cs
- FirstMatchCodeGroup.cs
- XmlNamespaceManager.cs
- MenuItemStyleCollection.cs
- ProcessInputEventArgs.cs
- ButtonPopupAdapter.cs
- PersonalizationEntry.cs
- GroupItemAutomationPeer.cs
- RtfNavigator.cs
- TextPatternIdentifiers.cs
- counter.cs
- DoubleAnimationUsingKeyFrames.cs
- RequestCacheManager.cs
- TableParagraph.cs
- FieldToken.cs
- AnyAllSearchOperator.cs
- SecuritySessionFilter.cs
- GroupStyle.cs
- TraceLevelStore.cs
- IPPacketInformation.cs
- DataControlFieldCollection.cs
- UserUseLicenseDictionaryLoader.cs
- OutputCacheSettingsSection.cs
- TypeBinaryExpression.cs
- CommandManager.cs
- HttpDebugHandler.cs
- HighlightComponent.cs
- AssemblyCollection.cs
- Maps.cs
- RuleInfoComparer.cs
- GridView.cs
- SchemaDeclBase.cs
- SafeCryptHandles.cs
- IDispatchConstantAttribute.cs
- ViewManager.cs
- WorkflowInstanceContextProvider.cs
- DataStreamFromComStream.cs
- GridPatternIdentifiers.cs
- AutomationTextAttribute.cs
- Dump.cs
- XmlnsCompatibleWithAttribute.cs
- StreamGeometryContext.cs
- DesignerProperties.cs
- DemultiplexingClientMessageFormatter.cs
- StorageConditionPropertyMapping.cs
- TemplatingOptionsDialog.cs
- StreamResourceInfo.cs
- HttpHostedTransportConfiguration.cs
- DataSourceControl.cs
- TextTreeUndo.cs
- InputScopeManager.cs
- SqlFunctionAttribute.cs
- MessageSecurityVersion.cs
- SqlRowUpdatedEvent.cs
- ReferencedType.cs
- SafeNativeMethods.cs
- WindowsRebar.cs
- RawStylusInputCustomData.cs
- DirtyTextRange.cs
- KerberosReceiverSecurityToken.cs
- SocketCache.cs
- SafeNativeMethods.cs
- ProtocolsConfigurationEntry.cs
- TraceContextRecord.cs
- SafeNativeMethods.cs
- CompilerTypeWithParams.cs