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
- ByteAnimationUsingKeyFrames.cs
- AppSettings.cs
- BidPrivateBase.cs
- TCEAdapterGenerator.cs
- LogicalExpr.cs
- SelectingProviderEventArgs.cs
- ExceptionHelpers.cs
- EventProviderBase.cs
- XmlTextAttribute.cs
- RightsController.cs
- TextRangeEditLists.cs
- SelectingProviderEventArgs.cs
- XsltContext.cs
- ThemeDirectoryCompiler.cs
- Ipv6Element.cs
- HotCommands.cs
- ScriptDescriptor.cs
- _ShellExpression.cs
- TimerEventSubscriptionCollection.cs
- NullNotAllowedCollection.cs
- XmlProcessingInstruction.cs
- TrackingAnnotationCollection.cs
- RayMeshGeometry3DHitTestResult.cs
- SpecularMaterial.cs
- RootNamespaceAttribute.cs
- SwitchLevelAttribute.cs
- XmlExpressionDumper.cs
- SupportsEventValidationAttribute.cs
- InkCanvasAutomationPeer.cs
- Label.cs
- XmlQueryStaticData.cs
- TargetException.cs
- TextTreeNode.cs
- DataGridViewCellValueEventArgs.cs
- MSAAWinEventWrap.cs
- DocumentOrderQuery.cs
- ExpressionBuilderContext.cs
- ISAPIWorkerRequest.cs
- SurrogateSelector.cs
- ParameterBuilder.cs
- GacUtil.cs
- CodeStatement.cs
- MdiWindowListItemConverter.cs
- DataGridViewButtonCell.cs
- BindingNavigator.cs
- MessagePartSpecification.cs
- SignedXml.cs
- TextEditorTables.cs
- TrackingDataItem.cs
- Models.cs
- XmlReflectionImporter.cs
- XmlSerializationWriter.cs
- CatchBlock.cs
- ModelTypeConverter.cs
- UnionQueryOperator.cs
- Soap.cs
- PrimitiveXmlSerializers.cs
- BitmapSource.cs
- QueryableDataSourceEditData.cs
- util.cs
- XamlInt32CollectionSerializer.cs
- MimeXmlReflector.cs
- DesignerInterfaces.cs
- infer.cs
- ListViewUpdatedEventArgs.cs
- XLinq.cs
- RegexInterpreter.cs
- XPathScanner.cs
- ParsedAttributeCollection.cs
- TailCallAnalyzer.cs
- View.cs
- WinEventTracker.cs
- XmlName.cs
- SimpleLine.cs
- GridViewHeaderRowPresenter.cs
- WrapperSecurityCommunicationObject.cs
- BulletedListEventArgs.cs
- CallContext.cs
- CorruptingExceptionCommon.cs
- PrimitiveList.cs
- PersonalizationStateInfoCollection.cs
- Model3DGroup.cs
- DataServiceQuery.cs
- ConnectionsZone.cs
- PropertyDescriptors.cs
- ImageIndexConverter.cs
- EmptyQuery.cs
- SqlLiftWhereClauses.cs
- HybridObjectCache.cs
- WebPartZoneCollection.cs
- TTSVoice.cs
- DoubleConverter.cs
- Model3D.cs
- TextEndOfLine.cs
- HostedHttpRequestAsyncResult.cs
- BinarySerializer.cs
- HuffCodec.cs
- VirtualDirectoryMappingCollection.cs
- LOSFormatter.cs
- Root.cs