Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Data / System / Data / OleDb / OleDbReferenceCollection.cs / 1 / OleDbReferenceCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data.OleDb {
using System;
using System.Data;
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
using System.Runtime.InteropServices;
sealed internal class OleDbReferenceCollection : DbReferenceCollection {
internal const int Closing = 0;
internal const int Canceling = -1;
internal const int CommandTag = 1;
internal const int DataReaderTag = 2;
override public void Add(object value, int tag) {
base.AddItem(value, tag);
}
override protected bool NotifyItem(int message, int tag, object value) {
bool canceling = (Canceling == message);
if (CommandTag == tag) {
((OleDbCommand) value).CloseCommandFromConnection(canceling);
}
else if (DataReaderTag == tag) {
((OleDbDataReader) value).CloseReaderFromConnection(canceling);
}
else {
Debug.Assert(false, "shouldn't be here");
}
return false; // remove it from the collection
}
override public void Remove(object value) {
base.RemoveItem(value);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data.OleDb {
using System;
using System.Data;
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
using System.Runtime.InteropServices;
sealed internal class OleDbReferenceCollection : DbReferenceCollection {
internal const int Closing = 0;
internal const int Canceling = -1;
internal const int CommandTag = 1;
internal const int DataReaderTag = 2;
override public void Add(object value, int tag) {
base.AddItem(value, tag);
}
override protected bool NotifyItem(int message, int tag, object value) {
bool canceling = (Canceling == message);
if (CommandTag == tag) {
((OleDbCommand) value).CloseCommandFromConnection(canceling);
}
else if (DataReaderTag == tag) {
((OleDbDataReader) value).CloseReaderFromConnection(canceling);
}
else {
Debug.Assert(false, "shouldn't be here");
}
return false; // remove it from the collection
}
override public void Remove(object value) {
base.RemoveItem(value);
}
}
}
// 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
- CapiHashAlgorithm.cs
- XPathItem.cs
- SpellerInterop.cs
- EventsTab.cs
- PinnedBufferMemoryStream.cs
- VersionedStreamOwner.cs
- ModifierKeysConverter.cs
- linebase.cs
- FormattedText.cs
- BCLDebug.cs
- RubberbandSelector.cs
- DataGridViewImageColumn.cs
- StandardRuntimeEnumValidatorAttribute.cs
- SpanIndex.cs
- ObjectSecurity.cs
- SqlNotificationRequest.cs
- String.cs
- RadioButtonAutomationPeer.cs
- SiteMapDataSourceDesigner.cs
- HashRepartitionStream.cs
- MappingException.cs
- HtmlUtf8RawTextWriter.cs
- ToolStripSplitButton.cs
- WebDisplayNameAttribute.cs
- IPPacketInformation.cs
- SqlConnectionString.cs
- Parameter.cs
- CanonicalizationDriver.cs
- TemplateGroupCollection.cs
- XmlSchemaSimpleContentExtension.cs
- OracleRowUpdatedEventArgs.cs
- QilGenerator.cs
- linebase.cs
- UserControlDesigner.cs
- TextChange.cs
- SqlCacheDependency.cs
- NotifyIcon.cs
- MemoryPressure.cs
- FrameworkTemplate.cs
- DynamicPropertyHolder.cs
- smtppermission.cs
- formatter.cs
- PerfService.cs
- CreateUserErrorEventArgs.cs
- Clock.cs
- DataKey.cs
- TripleDESCryptoServiceProvider.cs
- TextReader.cs
- WindowsSysHeader.cs
- Rotation3DAnimationBase.cs
- _Win32.cs
- RelationalExpressions.cs
- MultiByteCodec.cs
- FilteredXmlReader.cs
- SortedList.cs
- DownloadProgressEventArgs.cs
- RectangleGeometry.cs
- PropertyValue.cs
- AspCompat.cs
- DefaultValueAttribute.cs
- QuaternionKeyFrameCollection.cs
- StorageBasedPackageProperties.cs
- AmbientValueAttribute.cs
- TriggerActionCollection.cs
- RightsManagementInformation.cs
- OleDbReferenceCollection.cs
- Rect3DValueSerializer.cs
- Models.cs
- BinaryParser.cs
- _CommandStream.cs
- EdmSchemaAttribute.cs
- FloatUtil.cs
- _PooledStream.cs
- XmlSerializerObjectSerializer.cs
- ContractSearchPattern.cs
- PointHitTestResult.cs
- DelegateTypeInfo.cs
- ModuleConfigurationInfo.cs
- RightsManagementProvider.cs
- ExtenderProvidedPropertyAttribute.cs
- ArgumentValue.cs
- SessionStateSection.cs
- WsdlBuildProvider.cs
- LayoutEvent.cs
- PassportAuthenticationEventArgs.cs
- ReachVisualSerializer.cs
- DBDataPermission.cs
- ListArgumentProvider.cs
- AffineTransform3D.cs
- AuthorizationRule.cs
- TimeoutValidationAttribute.cs
- ToolboxItemCollection.cs
- ParamArrayAttribute.cs
- DrawListViewSubItemEventArgs.cs
- AppliedDeviceFiltersDialog.cs
- CacheDependency.cs
- XMLSyntaxException.cs
- DbDeleteCommandTree.cs
- RewritingProcessor.cs
- NameValueCollection.cs