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
- UInt32Converter.cs
- RbTree.cs
- CharacterString.cs
- PrimitiveType.cs
- _ProxyChain.cs
- MatrixCamera.cs
- DesignTimeValidationFeature.cs
- XmlHierarchicalDataSourceView.cs
- CapabilitiesState.cs
- IISUnsafeMethods.cs
- OleDbConnectionFactory.cs
- GridSplitterAutomationPeer.cs
- FormsAuthentication.cs
- BamlMapTable.cs
- SafeLocalMemHandle.cs
- JsonObjectDataContract.cs
- HttpChannelFactory.cs
- SerialStream.cs
- RadioButtonList.cs
- CapabilitiesAssignment.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- WpfWebRequestHelper.cs
- ServiceAuthorizationBehavior.cs
- SqlUdtInfo.cs
- DataErrorValidationRule.cs
- ThumbButtonInfo.cs
- ColumnResizeAdorner.cs
- Permission.cs
- SpecularMaterial.cs
- Trace.cs
- ConfigXmlReader.cs
- ColorAnimationBase.cs
- DNS.cs
- ExportOptions.cs
- ScriptingSectionGroup.cs
- PublishLicense.cs
- XPathAncestorQuery.cs
- BindingContext.cs
- NegotiationTokenAuthenticatorState.cs
- WriteableBitmap.cs
- TextFormatter.cs
- SmiTypedGetterSetter.cs
- PersistChildrenAttribute.cs
- TextProviderWrapper.cs
- DbXmlEnabledProviderManifest.cs
- RoleExceptions.cs
- HttpStreams.cs
- XPathParser.cs
- TheQuery.cs
- CodeArgumentReferenceExpression.cs
- EditorPart.cs
- ObjectDataSourceMethodEventArgs.cs
- HostedElements.cs
- ComponentDispatcher.cs
- TrackingServices.cs
- SynchronizationHandlesCodeDomSerializer.cs
- AssemblyNameProxy.cs
- MethodRental.cs
- GeometryDrawing.cs
- WhileDesigner.cs
- AnnotationObservableCollection.cs
- ObfuscateAssemblyAttribute.cs
- Parsers.cs
- XmlSchemaAny.cs
- TreeViewTemplateSelector.cs
- GeneralTransform3DGroup.cs
- Operators.cs
- AjaxFrameworkAssemblyAttribute.cs
- BamlReader.cs
- StyleBamlTreeBuilder.cs
- HtmlLink.cs
- ServiceReference.cs
- KeyedHashAlgorithm.cs
- WebProxyScriptElement.cs
- PropertyPathConverter.cs
- TargetPerspective.cs
- Pair.cs
- FixedElement.cs
- StorageConditionPropertyMapping.cs
- DecimalConstantAttribute.cs
- XmlCharacterData.cs
- PropertyValidationContext.cs
- InvokeGenerator.cs
- DrawingImage.cs
- MonitorWrapper.cs
- HttpServerVarsCollection.cs
- ProcessHost.cs
- safex509handles.cs
- SudsCommon.cs
- RegexFCD.cs
- SqlInternalConnectionSmi.cs
- ObjectHandle.cs
- IdentityNotMappedException.cs
- ChildrenQuery.cs
- Button.cs
- ThreadExceptionDialog.cs
- KeyPressEvent.cs
- CodeDomLoader.cs
- ToolStripSplitStackLayout.cs
- ReferenceSchema.cs