Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WorkflowExecutor.cs
- PropertyEmitter.cs
- GAC.cs
- SessionParameter.cs
- MouseActionConverter.cs
- Int32RectConverter.cs
- NameValuePair.cs
- FixedSOMGroup.cs
- EntityCommandExecutionException.cs
- ItemType.cs
- DataGridViewCellLinkedList.cs
- RootNamespaceAttribute.cs
- URLString.cs
- URLAttribute.cs
- VirtualDirectoryMapping.cs
- SwitchAttribute.cs
- TrustLevel.cs
- TimeSpanMinutesConverter.cs
- DomainConstraint.cs
- ApplicationTrust.cs
- EraserBehavior.cs
- MarkupObject.cs
- MetricEntry.cs
- UInt32Storage.cs
- DataGridViewCellEventArgs.cs
- RotateTransform.cs
- DetailsViewRowCollection.cs
- XmlSchemaDatatype.cs
- MediaElement.cs
- DataGridViewCellParsingEventArgs.cs
- CngKey.cs
- DataService.cs
- WebReferencesBuildProvider.cs
- DetailsViewInsertEventArgs.cs
- TextEffectResolver.cs
- OAVariantLib.cs
- FocusWithinProperty.cs
- SoapIncludeAttribute.cs
- TextContainerHelper.cs
- StreamAsIStream.cs
- DataConnectionHelper.cs
- FormViewUpdateEventArgs.cs
- UIServiceHelper.cs
- RecommendedAsConfigurableAttribute.cs
- WebPartExportVerb.cs
- LoadedOrUnloadedOperation.cs
- CompositeControl.cs
- SerializerDescriptor.cs
- FrugalMap.cs
- Message.cs
- ListenerHandler.cs
- SiteMapNodeCollection.cs
- TreeNodeBindingCollection.cs
- ImageMap.cs
- RuntimeArgumentHandle.cs
- RoleService.cs
- WindowsContainer.cs
- XmlSchemaSimpleTypeRestriction.cs
- ParseHttpDate.cs
- HtmlGenericControl.cs
- RTLAwareMessageBox.cs
- FixedSOMPageElement.cs
- RadioButton.cs
- TypeDescriptionProvider.cs
- RegexInterpreter.cs
- AlternateView.cs
- DropDownList.cs
- CaseInsensitiveHashCodeProvider.cs
- DoubleAnimationUsingKeyFrames.cs
- AbsoluteQuery.cs
- SmtpFailedRecipientException.cs
- StreamReader.cs
- LogStore.cs
- SingleTagSectionHandler.cs
- NativeMethods.cs
- COMException.cs
- PersianCalendar.cs
- TextTreeUndo.cs
- TaskFormBase.cs
- Point3DAnimationBase.cs
- ColumnPropertiesGroup.cs
- DrawingCollection.cs
- TransactionScope.cs
- BamlRecordReader.cs
- FilterException.cs
- WebBrowsableAttribute.cs
- WrappedOptions.cs
- EncoderReplacementFallback.cs
- HttpSessionStateWrapper.cs
- DesignBindingValueUIHandler.cs
- AnnotationAuthorChangedEventArgs.cs
- CaretElement.cs
- ProcessHostFactoryHelper.cs
- TextEditorContextMenu.cs
- BitmapCodecInfo.cs
- SeparatorAutomationPeer.cs
- CollectionsUtil.cs
- DBConcurrencyException.cs
- MediaSystem.cs
- RegionIterator.cs