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
- HttpModulesSection.cs
- HeaderedItemsControl.cs
- ExtensibleSyndicationObject.cs
- TdsParserStateObject.cs
- DataColumn.cs
- SqlCommand.cs
- MatrixKeyFrameCollection.cs
- ThreadPool.cs
- IndicShape.cs
- ContentPresenter.cs
- LogicalExpr.cs
- WebBrowserDocumentCompletedEventHandler.cs
- DBCSCodePageEncoding.cs
- RemotingHelper.cs
- WinEventHandler.cs
- __ComObject.cs
- IconBitmapDecoder.cs
- SchemaMerger.cs
- Column.cs
- ManifestResourceInfo.cs
- DependencyPropertyKind.cs
- EndSelectCardRequest.cs
- TTSEngineTypes.cs
- Literal.cs
- SystemPens.cs
- XmlQueryRuntime.cs
- DictionaryEditChange.cs
- SqlMethodCallConverter.cs
- NavigationHelper.cs
- RegexWorker.cs
- DataGridColumnsPage.cs
- TableLayoutPanel.cs
- GcHandle.cs
- Stream.cs
- BinaryExpressionHelper.cs
- PageOutputColor.cs
- CfgParser.cs
- HttpApplicationFactory.cs
- SqlDataSourceView.cs
- ResizeGrip.cs
- Exception.cs
- TransformerInfoCollection.cs
- LayoutEditorPart.cs
- OdbcConnection.cs
- AddressingVersion.cs
- UTF8Encoding.cs
- AvTraceFormat.cs
- XPathScanner.cs
- LoadRetryStrategyFactory.cs
- xmlformatgeneratorstatics.cs
- LongTypeConverter.cs
- ProfileGroupSettingsCollection.cs
- DataGridViewRowsAddedEventArgs.cs
- TransportSecurityProtocolFactory.cs
- XmlSchemas.cs
- XmlSchemaObject.cs
- GroupItemAutomationPeer.cs
- UIElementCollection.cs
- NumberFormatInfo.cs
- AlternationConverter.cs
- XamlPointCollectionSerializer.cs
- dataprotectionpermission.cs
- CommandID.cs
- DragAssistanceManager.cs
- RelatedView.cs
- PropertyGeneratedEventArgs.cs
- CodeAttributeArgument.cs
- CodeLinePragma.cs
- HttpHandlersSection.cs
- MultiView.cs
- ITreeGenerator.cs
- CheckedPointers.cs
- DataBoundControlAdapter.cs
- webclient.cs
- TypeBuilderInstantiation.cs
- StandardCommandToolStripMenuItem.cs
- UIAgentInitializationException.cs
- InkSerializer.cs
- XPathAncestorQuery.cs
- DecoratedNameAttribute.cs
- CodeMethodInvokeExpression.cs
- ContentElement.cs
- ZipPackagePart.cs
- NamespaceDecl.cs
- ReflectionUtil.cs
- ColorAnimationBase.cs
- Fonts.cs
- WSDualHttpSecurity.cs
- ServicePoint.cs
- MouseButton.cs
- ConfigXmlElement.cs
- HybridCollection.cs
- Query.cs
- ExpressionsCollectionEditor.cs
- ReferentialConstraint.cs
- OleDbFactory.cs
- QueryStringParameter.cs
- EtwTrackingBehavior.cs
- Substitution.cs
- SendKeys.cs