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
- ActivationServices.cs
- VersionedStream.cs
- DateTimeConverter.cs
- JsonDataContract.cs
- UriWriter.cs
- LeaseManager.cs
- EntitySetDataBindingList.cs
- DateTimeStorage.cs
- LabelExpression.cs
- NetNamedPipeSecurityElement.cs
- UInt64Converter.cs
- ScrollEvent.cs
- InvokeWebService.cs
- EventHandlersStore.cs
- HttpConfigurationContext.cs
- SystemResourceHost.cs
- XmlHierarchicalEnumerable.cs
- StylusButtonCollection.cs
- LeftCellWrapper.cs
- FileDataSourceCache.cs
- ResourceAttributes.cs
- SqlException.cs
- ScrollBar.cs
- DesignerDataStoredProcedure.cs
- HtmlTableRowCollection.cs
- SocketCache.cs
- ProfileEventArgs.cs
- UnsafeNativeMethods.cs
- dtdvalidator.cs
- UnionExpr.cs
- DynamicUpdateCommand.cs
- ContractSearchPattern.cs
- ToolStripProgressBar.cs
- ApplicationDirectory.cs
- GPStream.cs
- ValuePattern.cs
- ViewSimplifier.cs
- InputScopeNameConverter.cs
- ControlUtil.cs
- DescendantQuery.cs
- UnicodeEncoding.cs
- HtmlInputRadioButton.cs
- AssemblyBuilder.cs
- ProgressPage.cs
- DirectoryGroupQuery.cs
- _CacheStreams.cs
- ButtonAutomationPeer.cs
- Console.cs
- PeoplePickerWrapper.cs
- ParseChildrenAsPropertiesAttribute.cs
- OutputWindow.cs
- QilScopedVisitor.cs
- PersonalizationProvider.cs
- BlockUIContainer.cs
- SpecialNameAttribute.cs
- ValidationError.cs
- GroupBoxRenderer.cs
- AmbientLight.cs
- ScriptResourceInfo.cs
- DBProviderConfigurationHandler.cs
- StandardCommands.cs
- SoapRpcServiceAttribute.cs
- MetadataCache.cs
- TextShapeableCharacters.cs
- JournalEntry.cs
- WindowsTitleBar.cs
- WebPartManagerInternals.cs
- XamlInt32CollectionSerializer.cs
- DataKey.cs
- CompModSwitches.cs
- XamlBrushSerializer.cs
- IntPtr.cs
- SystemWebCachingSectionGroup.cs
- Tuple.cs
- LayoutSettings.cs
- OdbcParameter.cs
- PropertyEmitterBase.cs
- Matrix.cs
- CLRBindingWorker.cs
- Point4D.cs
- ExtenderProvidedPropertyAttribute.cs
- FullTextBreakpoint.cs
- DataTableNewRowEvent.cs
- Message.cs
- CleanUpVirtualizedItemEventArgs.cs
- FigureParagraph.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- ResourceManager.cs
- SqlLiftWhereClauses.cs
- RectConverter.cs
- HeaderedItemsControl.cs
- Visitor.cs
- BaseConfigurationRecord.cs
- EntityKey.cs
- TableRow.cs
- SerializableAttribute.cs
- WebResourceAttribute.cs
- DrawingBrush.cs
- DataConnectionHelper.cs
- OracleDataAdapter.cs