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
- DataGridViewMethods.cs
- TemplateControl.cs
- DynamicPropertyReader.cs
- BitmapEffectGeneralTransform.cs
- RotateTransform3D.cs
- ServiceDurableInstanceContextProvider.cs
- StringHelper.cs
- ColumnProvider.cs
- SizeChangedInfo.cs
- Container.cs
- Span.cs
- FormViewPagerRow.cs
- InputScopeManager.cs
- ReachFixedDocumentSerializerAsync.cs
- FixedElement.cs
- Rights.cs
- shaperfactoryquerycacheentry.cs
- SymmetricCryptoHandle.cs
- PreservationFileReader.cs
- PanelDesigner.cs
- WindowsProgressbar.cs
- InstanceLockedException.cs
- TypeBuilder.cs
- ListViewCancelEventArgs.cs
- VisualProxy.cs
- SecurityKeyType.cs
- GeometryCollection.cs
- IMembershipProvider.cs
- XmlBinaryReaderSession.cs
- CodeAttributeDeclaration.cs
- ConfigurationSettings.cs
- DBAsyncResult.cs
- MarkedHighlightComponent.cs
- ContractType.cs
- ToRequest.cs
- TypeConverterValueSerializer.cs
- GetReadStreamResult.cs
- DefaultValidator.cs
- Listbox.cs
- DataTableExtensions.cs
- NetTcpSection.cs
- StorageEntitySetMapping.cs
- RootBuilder.cs
- SafeCryptoHandles.cs
- FontStretch.cs
- SimpleWebHandlerParser.cs
- OrderedDictionary.cs
- WebBrowserNavigatingEventHandler.cs
- DLinqDataModelProvider.cs
- AdjustableArrowCap.cs
- ClientTargetCollection.cs
- ProcessStartInfo.cs
- XmlUTF8TextWriter.cs
- StateMachineDesignerPaint.cs
- FormsAuthenticationEventArgs.cs
- OdbcFactory.cs
- ReadOnlyMetadataCollection.cs
- Atom10FormatterFactory.cs
- ListControl.cs
- SqlEnums.cs
- DocumentSchemaValidator.cs
- DataGridViewTopRowAccessibleObject.cs
- EdmValidator.cs
- DataDesignUtil.cs
- AspNetSynchronizationContext.cs
- ThrowHelper.cs
- UnaryQueryOperator.cs
- ColumnTypeConverter.cs
- SqlExpander.cs
- DataGridRow.cs
- LifetimeServices.cs
- ValueTypeFixupInfo.cs
- ResponseBodyWriter.cs
- VScrollProperties.cs
- NestPullup.cs
- RoutedEventValueSerializer.cs
- ColorKeyFrameCollection.cs
- _NativeSSPI.cs
- DescendantBaseQuery.cs
- IsolatedStorageFileStream.cs
- COM2TypeInfoProcessor.cs
- FrugalMap.cs
- TextEditorParagraphs.cs
- ALinqExpressionVisitor.cs
- OdbcConnection.cs
- MetaDataInfo.cs
- TextEndOfLine.cs
- Convert.cs
- CredentialCache.cs
- ListItemConverter.cs
- RegexCaptureCollection.cs
- ProviderConnectionPointCollection.cs
- OdbcParameter.cs
- NavigationFailedEventArgs.cs
- EmptyStringExpandableObjectConverter.cs
- ConfigurationValue.cs
- GuidelineSet.cs
- OleDbDataAdapter.cs
- SignatureHelper.cs
- OledbConnectionStringbuilder.cs