Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / OptionalColumn.cs / 1305376 / OptionalColumn.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; namespace System.Data.SqlClient.SqlGen { ////// Represents a column in a select list that should be printed only if it is later used. /// Such columns get added by internal sealed class OptionalColumn { #region Private State private readonly SymbolUsageManager m_usageManager; // The SqlBuilder that contains the column building blocks (e.g: "c.X as X1") private readonly SqlBuilder m_builder = new SqlBuilder(); // The symbol representing the optional column private readonly Symbol m_symbol; #endregion #region Internal Methods ///. /// The SymbolUsageManager associated with the OptionalColumn has the information whether the column /// has been used based on its symbol. /// /// Append to the "fragment" representing this column /// internal void Append(object s) { m_builder.Append(s); } internal void MarkAsUsed() { this.m_usageManager.MarkAsUsed(this.m_symbol); } #endregion #region Constructor internal OptionalColumn(SymbolUsageManager usageManager, Symbol symbol) { this.m_usageManager = usageManager; this.m_symbol = symbol; } #endregion #region Internal members ////// Writes that fragment that represents the optional column /// if the usage manager says it is used. /// /// /// public bool WriteSqlIfUsed(SqlWriter writer, SqlGenerator sqlGenerator, string separator) { if (m_usageManager.IsUsed(m_symbol)) { writer.Write(separator); m_builder.WriteSql(writer, sqlGenerator); return true; } return false; } #endregion } } // 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; using System.Diagnostics; namespace System.Data.SqlClient.SqlGen { ////// Represents a column in a select list that should be printed only if it is later used. /// Such columns get added by internal sealed class OptionalColumn { #region Private State private readonly SymbolUsageManager m_usageManager; // The SqlBuilder that contains the column building blocks (e.g: "c.X as X1") private readonly SqlBuilder m_builder = new SqlBuilder(); // The symbol representing the optional column private readonly Symbol m_symbol; #endregion #region Internal Methods ///. /// The SymbolUsageManager associated with the OptionalColumn has the information whether the column /// has been used based on its symbol. /// /// Append to the "fragment" representing this column /// internal void Append(object s) { m_builder.Append(s); } internal void MarkAsUsed() { this.m_usageManager.MarkAsUsed(this.m_symbol); } #endregion #region Constructor internal OptionalColumn(SymbolUsageManager usageManager, Symbol symbol) { this.m_usageManager = usageManager; this.m_symbol = symbol; } #endregion #region Internal members ////// Writes that fragment that represents the optional column /// if the usage manager says it is used. /// /// /// public bool WriteSqlIfUsed(SqlWriter writer, SqlGenerator sqlGenerator, string separator) { if (m_usageManager.IsUsed(m_symbol)) { writer.Write(separator); m_builder.WriteSql(writer, sqlGenerator); return true; } return false; } #endregion } } // 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
- DocumentApplicationJournalEntry.cs
- ElementProxy.cs
- SiteMembershipCondition.cs
- Matrix.cs
- ResXFileRef.cs
- ImportCatalogPart.cs
- DefaultPropertyAttribute.cs
- ImageSourceConverter.cs
- ViewStateException.cs
- DragEvent.cs
- SectionRecord.cs
- ExpressionList.cs
- DiscoveryRequestHandler.cs
- MenuItemBindingCollection.cs
- DEREncoding.cs
- ObjectPersistData.cs
- DataGridViewSelectedColumnCollection.cs
- DataGridTableCollection.cs
- ObfuscationAttribute.cs
- StorageFunctionMapping.cs
- SubclassTypeValidatorAttribute.cs
- XmlSchemaSimpleContentExtension.cs
- SystemWebCachingSectionGroup.cs
- DataListComponentEditor.cs
- BatchWriter.cs
- BindingMemberInfo.cs
- StrongNameHelpers.cs
- SQLDouble.cs
- RenderingEventArgs.cs
- MediaTimeline.cs
- SmtpException.cs
- MostlySingletonList.cs
- HttpModuleActionCollection.cs
- ValuePattern.cs
- PixelShader.cs
- HtmlInputCheckBox.cs
- DispatchWrapper.cs
- ProxyHelper.cs
- TableLayoutPanelCellPosition.cs
- ValidationContext.cs
- CharacterShapingProperties.cs
- TransformedBitmap.cs
- StorageInfo.cs
- NameTable.cs
- CheckBoxRenderer.cs
- BreakSafeBase.cs
- CertificateManager.cs
- DoubleAnimationUsingKeyFrames.cs
- ImageMapEventArgs.cs
- SymLanguageType.cs
- PropertyRef.cs
- NotSupportedException.cs
- EventSinkActivity.cs
- SpecialFolderEnumConverter.cs
- QueryableDataSource.cs
- ScrollChrome.cs
- PathFigure.cs
- ConnectionConsumerAttribute.cs
- CounterSampleCalculator.cs
- Vector3DAnimationUsingKeyFrames.cs
- TypeExtension.cs
- TextContainerHelper.cs
- HttpGetProtocolImporter.cs
- ControlOperationBehavior.cs
- ContextMenu.cs
- LoggedException.cs
- TransportSecurityHelpers.cs
- ProjectionPruner.cs
- ToolStripGripRenderEventArgs.cs
- SymLanguageType.cs
- DelegatingTypeDescriptionProvider.cs
- ISAPIApplicationHost.cs
- StdValidatorsAndConverters.cs
- ToolStripPanelCell.cs
- DataSourceXmlSerializer.cs
- DataFieldCollectionEditor.cs
- ListViewDataItem.cs
- FixedLineResult.cs
- Evidence.cs
- DependencyStoreSurrogate.cs
- DependencySource.cs
- XmlSchemaSet.cs
- ServicePoint.cs
- _Connection.cs
- TypeValidationEventArgs.cs
- XmlSchemaGroupRef.cs
- TagPrefixAttribute.cs
- FixUpCollection.cs
- EntityContainerEntitySet.cs
- XmlAttribute.cs
- TextTreeText.cs
- ModuleBuilderData.cs
- BlurBitmapEffect.cs
- GridViewCommandEventArgs.cs
- DecimalKeyFrameCollection.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- AnnotationStore.cs
- BaseConfigurationRecord.cs
- XmlSerializerVersionAttribute.cs
- TextPattern.cs