Code:
/ 4.0 / 4.0 / 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 DictionaryoptionalColumnUsage = 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. //---------------------------------------------------------------------- // // 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 DictionaryoptionalColumnUsage = 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
- GcSettings.cs
- X509CertificateValidator.cs
- MergeLocalizationDirectives.cs
- TextServicesDisplayAttribute.cs
- BuildDependencySet.cs
- GPRECTF.cs
- ProtocolState.cs
- Int64.cs
- TextSerializer.cs
- XmlSchemaComplexType.cs
- LinkButton.cs
- Rect3D.cs
- TableProviderWrapper.cs
- CredentialSelector.cs
- SourceInterpreter.cs
- WorkflowViewElement.cs
- GridViewUpdateEventArgs.cs
- WindowsImpersonationContext.cs
- SessionPageStatePersister.cs
- CultureSpecificStringDictionary.cs
- SiteOfOriginContainer.cs
- ArrayElementGridEntry.cs
- WindowsListViewGroupHelper.cs
- DataGridBeginningEditEventArgs.cs
- ApplicationServicesHostFactory.cs
- EntityException.cs
- ProfileInfo.cs
- EmptyCollection.cs
- PrimaryKeyTypeConverter.cs
- Message.cs
- RNGCryptoServiceProvider.cs
- AstNode.cs
- GPPOINT.cs
- SQLSingleStorage.cs
- UserControlAutomationPeer.cs
- SrgsSubset.cs
- WebHttpSecurityElement.cs
- XmlNullResolver.cs
- ListBindingConverter.cs
- FormsIdentity.cs
- FlowDocumentReader.cs
- AnnotationStore.cs
- ResourceProperty.cs
- EntityAdapter.cs
- HostingEnvironmentException.cs
- ConnectionStringsSection.cs
- SettingsProviderCollection.cs
- InstallerTypeAttribute.cs
- SourceFileBuildProvider.cs
- _Events.cs
- FreezableCollection.cs
- XmlSchemaComplexType.cs
- CompilerScope.cs
- FileChangesMonitor.cs
- CodeGotoStatement.cs
- DbConnectionStringCommon.cs
- HighlightComponent.cs
- MappingMetadataHelper.cs
- KeyNotFoundException.cs
- SQLString.cs
- CodeTypeMemberCollection.cs
- ToolboxItemAttribute.cs
- AvTraceDetails.cs
- MetaForeignKeyColumn.cs
- ResourceWriter.cs
- BitmapEffectGeneralTransform.cs
- SvcMapFileLoader.cs
- Win32.cs
- HtmlInputReset.cs
- WindowInteropHelper.cs
- TransportDefaults.cs
- HScrollProperties.cs
- ScopelessEnumAttribute.cs
- TemplateInstanceAttribute.cs
- PageThemeCodeDomTreeGenerator.cs
- DetailsViewCommandEventArgs.cs
- DelegateSerializationHolder.cs
- AutomationProperties.cs
- ExpressionList.cs
- SqlProfileProvider.cs
- ImageListStreamer.cs
- XmlDictionaryReaderQuotas.cs
- Pair.cs
- TraceXPathNavigator.cs
- DiagnosticEventProvider.cs
- SystemTcpStatistics.cs
- addressfiltermode.cs
- KeyTimeConverter.cs
- FileLogRecord.cs
- FixedSOMTableRow.cs
- WindowsStreamSecurityElement.cs
- DesignerLinkAdapter.cs
- AppDomainManager.cs
- COM2Enum.cs
- ResourcePart.cs
- ExpressionBuilderCollection.cs
- RowUpdatingEventArgs.cs
- SystemIPGlobalStatistics.cs
- StrongName.cs
- ViewStateModeByIdAttribute.cs