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
- AxisAngleRotation3D.cs
- DataSvcMapFile.cs
- TypeBinaryExpression.cs
- XmlElementAttributes.cs
- BitmapSource.cs
- CodeTypeMemberCollection.cs
- Internal.cs
- RepeaterItem.cs
- Pair.cs
- MemoryFailPoint.cs
- AnnouncementEndpoint.cs
- TemplateBindingExpressionConverter.cs
- TraceHandlerErrorFormatter.cs
- TextServicesCompartment.cs
- HttpServerVarsCollection.cs
- NameValuePermission.cs
- ApplicationActivator.cs
- TemplateControlBuildProvider.cs
- AppSettingsExpressionBuilder.cs
- StickyNote.cs
- XamlFigureLengthSerializer.cs
- UnescapedXmlDiagnosticData.cs
- PropertyPathWorker.cs
- SmiMetaData.cs
- followingsibling.cs
- FormsAuthenticationModule.cs
- SrgsElementFactoryCompiler.cs
- StyleXamlParser.cs
- BamlTreeNode.cs
- ParameterElement.cs
- JoinCqlBlock.cs
- DeclaredTypeValidator.cs
- ParseHttpDate.cs
- TrustManager.cs
- Annotation.cs
- XhtmlTextWriter.cs
- XmlSchemas.cs
- ObjectDataSourceMethodEventArgs.cs
- ParserStack.cs
- Predicate.cs
- MemberInfoSerializationHolder.cs
- DataSourceHelper.cs
- DataServiceContext.cs
- xmlglyphRunInfo.cs
- Margins.cs
- MailMessage.cs
- SchemaInfo.cs
- DisplayNameAttribute.cs
- TabItemWrapperAutomationPeer.cs
- CorrelationTokenInvalidatedHandler.cs
- SettingsProperty.cs
- XmlHierarchyData.cs
- DataGridViewTopRowAccessibleObject.cs
- OrderablePartitioner.cs
- HttpModulesSection.cs
- ClientApiGenerator.cs
- PropertyValue.cs
- LineInfo.cs
- ImageList.cs
- QilLiteral.cs
- HttpCapabilitiesEvaluator.cs
- BamlTreeNode.cs
- DataSourceUtil.cs
- ProgressBar.cs
- EditingContext.cs
- ServiceDescriptionContext.cs
- Line.cs
- NamedServiceModelExtensionCollectionElement.cs
- ScrollProperties.cs
- DynamicQueryableWrapper.cs
- SafeUserTokenHandle.cs
- ObfuscationAttribute.cs
- SocketManager.cs
- DrawingVisualDrawingContext.cs
- MultiPropertyDescriptorGridEntry.cs
- ModuleBuilder.cs
- XmlMembersMapping.cs
- MimeAnyImporter.cs
- LinqDataView.cs
- TargetControlTypeAttribute.cs
- Mapping.cs
- TextServicesDisplayAttribute.cs
- ConstrainedDataObject.cs
- InstallerTypeAttribute.cs
- BaseDataListDesigner.cs
- MimeMultiPart.cs
- ActivityStateRecord.cs
- LicenseProviderAttribute.cs
- NumericExpr.cs
- MinimizableAttributeTypeConverter.cs
- FtpCachePolicyElement.cs
- Sql8ExpressionRewriter.cs
- Parameter.cs
- SchemaMerger.cs
- Win32NamedPipes.cs
- ListViewUpdateEventArgs.cs
- ProfileEventArgs.cs
- IntegerFacetDescriptionElement.cs
- ProcessModelInfo.cs
- ParameterToken.cs