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
- OleDbError.cs
- CompiledQuery.cs
- XamlWrapperReaders.cs
- TraceRecord.cs
- ClrProviderManifest.cs
- DbMetaDataColumnNames.cs
- StreamInfo.cs
- ProcessModule.cs
- OdbcCommandBuilder.cs
- PkcsMisc.cs
- KnownAssembliesSet.cs
- CqlParser.cs
- FontInfo.cs
- PtsHost.cs
- OneOf.cs
- RadialGradientBrush.cs
- TextOutput.cs
- AnimatedTypeHelpers.cs
- DependencyProperty.cs
- VScrollProperties.cs
- BuildProvider.cs
- CheckBoxStandardAdapter.cs
- HoistedLocals.cs
- LogEntryUtils.cs
- DbDeleteCommandTree.cs
- MultiPageTextView.cs
- NamespaceEmitter.cs
- Function.cs
- HtmlGenericControl.cs
- CloudCollection.cs
- SqlDataSourceFilteringEventArgs.cs
- FrameworkTextComposition.cs
- Converter.cs
- WebPartDisplayModeCollection.cs
- WindowsListBox.cs
- ZipQueryOperator.cs
- PropertyCollection.cs
- StaticExtensionConverter.cs
- Win32MouseDevice.cs
- BitmapImage.cs
- GridViewColumnHeader.cs
- LocatorPart.cs
- WebPartDescription.cs
- DataGridCellsPresenter.cs
- MouseCaptureWithinProperty.cs
- Effect.cs
- InfoCardKeyedHashAlgorithm.cs
- ScriptBehaviorDescriptor.cs
- SchemaLookupTable.cs
- QuaternionIndependentAnimationStorage.cs
- DataControlPagerLinkButton.cs
- Operand.cs
- RefreshPropertiesAttribute.cs
- SafeNativeMethods.cs
- ButtonBaseDesigner.cs
- ApplicationCommands.cs
- GradientSpreadMethodValidation.cs
- ParallelTimeline.cs
- _ContextAwareResult.cs
- XmlSchemaCollection.cs
- CodeValidator.cs
- InternalRelationshipCollection.cs
- VisualStyleElement.cs
- Error.cs
- DocumentOrderComparer.cs
- ImageListDesigner.cs
- BufferedGraphics.cs
- ping.cs
- TreeBuilder.cs
- SelectionWordBreaker.cs
- SignedPkcs7.cs
- WindowsListViewItemStartMenu.cs
- Control.cs
- SegmentInfo.cs
- ExpandSegmentCollection.cs
- WebBrowsableAttribute.cs
- BasicCommandTreeVisitor.cs
- RowUpdatedEventArgs.cs
- CheckableControlBaseAdapter.cs
- FunctionImportElement.cs
- Point3DValueSerializer.cs
- TraceContextEventArgs.cs
- ConditionalDesigner.cs
- ListViewCancelEventArgs.cs
- mactripleDES.cs
- UpdatePanelControlTrigger.cs
- TimelineClockCollection.cs
- UiaCoreProviderApi.cs
- WebConfigurationHost.cs
- LicFileLicenseProvider.cs
- SiteMembershipCondition.cs
- ExecutionEngineException.cs
- SqlInfoMessageEvent.cs
- DataGridViewRowsRemovedEventArgs.cs
- TemplateControl.cs
- MissingFieldException.cs
- EnumerableRowCollection.cs
- SchemaElement.cs
- WorkflowEventArgs.cs
- TextTreeUndoUnit.cs