Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DLinq / Dlinq / SqlClient / Common / SqlNodeAnnotations.cs / 1 / SqlNodeAnnotations.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace System.Data.Linq.SqlClient {
///
/// Associate annotations with SqlNodes.
///
internal class SqlNodeAnnotations {
Dictionary> annotationMap = new Dictionary>();
Dictionary uniqueTypes = new Dictionary();
///
/// Add an annotation to the given node.
///
internal void Add(SqlNode node, SqlNodeAnnotation annotation) {
List list = null;
if (!this.annotationMap.TryGetValue(node, out list)) {
list = new List();
this.annotationMap[node]=list;
}
uniqueTypes[annotation.GetType()] = String.Empty;
list.Add(annotation);
}
///
/// Gets the annotations for the given node. Null if none.
///
internal List Get(SqlNode node) {
List list = null;
this.annotationMap.TryGetValue(node, out list);
return list;
}
///
/// Whether the given node has annotations.
///
internal bool NodeIsAnnotated(SqlNode node) {
if (node == null)
return false;
return this.annotationMap.ContainsKey(node);
}
///
/// Checks whether there's at least one annotation of the given type.
///
internal bool HasAnnotationType(Type type) {
return this.uniqueTypes.ContainsKey(type);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
namespace System.Data.Linq.SqlClient {
///
/// Associate annotations with SqlNodes.
///
internal class SqlNodeAnnotations {
Dictionary> annotationMap = new Dictionary>();
Dictionary uniqueTypes = new Dictionary();
///
/// Add an annotation to the given node.
///
internal void Add(SqlNode node, SqlNodeAnnotation annotation) {
List list = null;
if (!this.annotationMap.TryGetValue(node, out list)) {
list = new List();
this.annotationMap[node]=list;
}
uniqueTypes[annotation.GetType()] = String.Empty;
list.Add(annotation);
}
///
/// Gets the annotations for the given node. Null if none.
///
internal List Get(SqlNode node) {
List list = null;
this.annotationMap.TryGetValue(node, out list);
return list;
}
///
/// Whether the given node has annotations.
///
internal bool NodeIsAnnotated(SqlNode node) {
if (node == null)
return false;
return this.annotationMap.ContainsKey(node);
}
///
/// Checks whether there's at least one annotation of the given type.
///
internal bool HasAnnotationType(Type type) {
return this.uniqueTypes.ContainsKey(type);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ColorContextHelper.cs
- UnsafeNativeMethods.cs
- AnnotationObservableCollection.cs
- CellTreeNodeVisitors.cs
- Thickness.cs
- Classification.cs
- DependencySource.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- ApplyTemplatesAction.cs
- DataGridHelper.cs
- KeyTimeConverter.cs
- DataGridViewCellConverter.cs
- XmlDataSourceNodeDescriptor.cs
- ProtocolElement.cs
- UserPersonalizationStateInfo.cs
- Converter.cs
- RectValueSerializer.cs
- ListBindingHelper.cs
- DrawingBrush.cs
- XmlSecureResolver.cs
- Int32Animation.cs
- AutoSizeToolBoxItem.cs
- X509WindowsSecurityToken.cs
- InputLangChangeEvent.cs
- TrackBarRenderer.cs
- IsolatedStorage.cs
- UIElementParaClient.cs
- CharAnimationUsingKeyFrames.cs
- PingReply.cs
- ControlType.cs
- GridSplitterAutomationPeer.cs
- ProcessModuleCollection.cs
- SqlDependencyListener.cs
- StyleConverter.cs
- ConfigurationElementCollection.cs
- WindowsMenu.cs
- XmlCustomFormatter.cs
- FileVersion.cs
- FormattedTextSymbols.cs
- SettingsAttributeDictionary.cs
- QilXmlWriter.cs
- TextBoxDesigner.cs
- StyleSelector.cs
- EntityCollection.cs
- RemotingServices.cs
- SelectionProcessor.cs
- NestPullup.cs
- TemplateBaseAction.cs
- OdbcConnectionHandle.cs
- OrderablePartitioner.cs
- SqlConnection.cs
- UdpConstants.cs
- TemplatedEditableDesignerRegion.cs
- SynchronizationLockException.cs
- FileCodeGroup.cs
- Comparer.cs
- HtmlShimManager.cs
- IFormattable.cs
- RawStylusInput.cs
- WebPartConnectionsCancelVerb.cs
- FilterQuery.cs
- ImageClickEventArgs.cs
- WebEventTraceProvider.cs
- PropertySourceInfo.cs
- FixedDocumentPaginator.cs
- CollectionEditorDialog.cs
- RowsCopiedEventArgs.cs
- ContainsRowNumberChecker.cs
- DesignSurfaceManager.cs
- ClusterRegistryConfigurationProvider.cs
- ContentFilePart.cs
- odbcmetadatafactory.cs
- AutomationIdentifier.cs
- WebPartsPersonalizationAuthorization.cs
- Enum.cs
- ColumnMapCopier.cs
- HtmlButton.cs
- MultiDataTrigger.cs
- SafeWaitHandle.cs
- PrefixQName.cs
- DrawingBrush.cs
- NavigationCommands.cs
- SimpleType.cs
- mediaeventargs.cs
- IconEditor.cs
- SystemInformation.cs
- Page.cs
- XmlSchemaNotation.cs
- ConfigurationManager.cs
- QilFactory.cs
- TypeConverterHelper.cs
- FixedSOMContainer.cs
- Style.cs
- ISFClipboardData.cs
- OutputCacheProfileCollection.cs
- DbSetClause.cs
- ConfigXmlDocument.cs
- WebPartVerbCollection.cs
- RouteValueExpressionBuilder.cs
- SiteMapNode.cs