Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / SymbolUsageManager.cs / 1305376 / SymbolUsageManager.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
namespace System.Data.SqlClient.SqlGen
{
///
/// Used for wrapping a boolean value as an object.
///
internal class BoolWrapper
{
internal bool Value {get; set;}
internal BoolWrapper()
{
this.Value = false;
}
}
///
/// Tracks the usage of symbols.
/// When registering a symbol with the usage manager if an input symbol is specified,
/// than the usage of the two is 'connected' - if one ever gets marked as used,
/// the other one becomes 'used' too.
///
internal class SymbolUsageManager
{
private readonly Dictionary optionalColumnUsage = new Dictionary();
internal bool ContainsKey(Symbol key)
{
return optionalColumnUsage.ContainsKey(key);
}
internal bool TryGetValue(Symbol key, out bool value)
{
BoolWrapper wrapper;
if (optionalColumnUsage.TryGetValue(key, out wrapper))
{
value = wrapper.Value;
return true;
}
value = false;
return false;
}
internal void Add(Symbol sourceSymbol, Symbol symbolToAdd)
{
BoolWrapper wrapper;
if (sourceSymbol == null || !this.optionalColumnUsage.TryGetValue(sourceSymbol, out wrapper))
{
wrapper = new BoolWrapper();
}
this.optionalColumnUsage.Add(symbolToAdd, wrapper);
}
internal void MarkAsUsed(Symbol key)
{
if (optionalColumnUsage.ContainsKey(key))
{
optionalColumnUsage[key].Value = true;
}
}
internal bool IsUsed(Symbol key)
{
return optionalColumnUsage[key].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
- XmlSchemaInclude.cs
- FormattedTextSymbols.cs
- DataQuery.cs
- TypeReference.cs
- StringPropertyBuilder.cs
- DataKey.cs
- WebPartHelpVerb.cs
- BackStopAuthenticationModule.cs
- MD5CryptoServiceProvider.cs
- ExplicitDiscriminatorMap.cs
- XmlAtomicValue.cs
- MappingItemCollection.cs
- Error.cs
- DataGridViewColumnCollection.cs
- CodeTypeOfExpression.cs
- WebPartAddingEventArgs.cs
- RecognitionEventArgs.cs
- ImageMap.cs
- SecurityCapabilities.cs
- RectValueSerializer.cs
- TabPageDesigner.cs
- XmlSchemaSimpleContentExtension.cs
- WindowsIdentity.cs
- CrossContextChannel.cs
- Timer.cs
- ControlCachePolicy.cs
- SqlDataSourceSelectingEventArgs.cs
- BufferedGraphics.cs
- SystemWebCachingSectionGroup.cs
- SelectionItemPattern.cs
- TransformGroup.cs
- _IPv6Address.cs
- ListDictionaryInternal.cs
- LinqDataSourceView.cs
- XamlReaderConstants.cs
- GcSettings.cs
- TypeExtensionConverter.cs
- ConfigXmlReader.cs
- MarkupProperty.cs
- safesecurityhelperavalon.cs
- XmlWhitespace.cs
- Screen.cs
- ComplexTypeEmitter.cs
- tabpagecollectioneditor.cs
- TextParagraphCache.cs
- elementinformation.cs
- Item.cs
- XamlGridLengthSerializer.cs
- CompositeControl.cs
- TextEditorCharacters.cs
- NodeFunctions.cs
- PeerCollaboration.cs
- TextBounds.cs
- StrongTypingException.cs
- HttpStreamMessage.cs
- basenumberconverter.cs
- MouseGestureConverter.cs
- PropertyTabAttribute.cs
- InputScope.cs
- EncoderParameter.cs
- GenericWebPart.cs
- PeerNearMe.cs
- BCLDebug.cs
- XmlImplementation.cs
- HttpPostedFile.cs
- ConnectionDemuxer.cs
- OdbcConnectionFactory.cs
- SourceSwitch.cs
- HeaderLabel.cs
- DbDataReader.cs
- SchemaMapping.cs
- FixedSOMGroup.cs
- MetadataItemCollectionFactory.cs
- ObjectItemCollection.cs
- AmbientLight.cs
- HandlerBase.cs
- ExtensionSurface.cs
- ProviderConnectionPointCollection.cs
- RecipientServiceModelSecurityTokenRequirement.cs
- ObjectPersistData.cs
- AttachedPropertyDescriptor.cs
- WsdlBuildProvider.cs
- MapPathBasedVirtualPathProvider.cs
- Debug.cs
- StringValueConverter.cs
- Assert.cs
- DependencyObjectCodeDomSerializer.cs
- MeasurementDCInfo.cs
- CompilationUtil.cs
- RegexCompiler.cs
- XmlKeywords.cs
- RequestDescription.cs
- SequenceDesignerAccessibleObject.cs
- PrintEvent.cs
- NavigationProperty.cs
- DispatcherTimer.cs
- OracleSqlParser.cs
- EventListener.cs
- SeekStoryboard.cs
- StrokeIntersection.cs