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 .
/// The SymbolUsageManager associated with the OptionalColumn has the information whether the column
/// has been used based on its symbol.
///
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
///
/// 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 .
/// The SymbolUsageManager associated with the OptionalColumn has the information whether the column
/// has been used based on its symbol.
///
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
///
/// 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
- Decorator.cs
- TextSelectionHighlightLayer.cs
- ObjectAssociationEndMapping.cs
- RegisterInfo.cs
- GridItemProviderWrapper.cs
- ProviderBase.cs
- InfoCardKeyedHashAlgorithm.cs
- InkCanvasAutomationPeer.cs
- AutomationPatternInfo.cs
- XmlSchemaInferenceException.cs
- RoutedEvent.cs
- OracleDateTime.cs
- HttpResponseHeader.cs
- UInt16Converter.cs
- CalendarModeChangedEventArgs.cs
- TracedNativeMethods.cs
- XmlUTF8TextWriter.cs
- CookieHandler.cs
- AuthenticationManager.cs
- SchemaObjectWriter.cs
- ScriptingProfileServiceSection.cs
- RemotingException.cs
- DelegatingTypeDescriptionProvider.cs
- WebService.cs
- DataGridHeaderBorder.cs
- ReflectionUtil.cs
- UIElementParagraph.cs
- Formatter.cs
- GlyphRunDrawing.cs
- CmsInterop.cs
- Walker.cs
- CngProvider.cs
- Funcletizer.cs
- EdmComplexPropertyAttribute.cs
- TracedNativeMethods.cs
- HwndAppCommandInputProvider.cs
- Floater.cs
- XmlCharCheckingWriter.cs
- SpellerStatusTable.cs
- SqlCommandBuilder.cs
- HTMLTextWriter.cs
- SR.cs
- mactripleDES.cs
- EventOpcode.cs
- ManagedIStream.cs
- BlurBitmapEffect.cs
- ColumnTypeConverter.cs
- Visitor.cs
- ColorConvertedBitmap.cs
- SemaphoreFullException.cs
- BamlResourceDeserializer.cs
- DbParameterCollection.cs
- VBIdentifierNameEditor.cs
- ApplicationActivator.cs
- IProducerConsumerCollection.cs
- StaticDataManager.cs
- EmbeddedObject.cs
- ChineseLunisolarCalendar.cs
- mansign.cs
- DataBindingList.cs
- PersonalizationState.cs
- LineSegment.cs
- SessionIDManager.cs
- CapabilitiesRule.cs
- TablePattern.cs
- AppDomainFactory.cs
- OutputCacheModule.cs
- WhitespaceRuleReader.cs
- ExternalException.cs
- MappingSource.cs
- CompletedAsyncResult.cs
- UIElementCollection.cs
- WebPartEventArgs.cs
- AspCompat.cs
- PreservationFileWriter.cs
- _UriSyntax.cs
- ExpressionList.cs
- XmlArrayAttribute.cs
- ReflectionUtil.cs
- NetMsmqBinding.cs
- ValueType.cs
- FixedSOMTableCell.cs
- RepeatBehaviorConverter.cs
- ItemMap.cs
- ObfuscateAssemblyAttribute.cs
- iisPickupDirectory.cs
- MsdtcWrapper.cs
- OdbcPermission.cs
- SourceFileBuildProvider.cs
- ChtmlTextBoxAdapter.cs
- HandlerBase.cs
- GuidelineSet.cs
- SecurityListenerSettingsLifetimeManager.cs
- FileDialogCustomPlace.cs
- MenuItem.cs
- TextSchema.cs
- RequestResizeEvent.cs
- DateTimeConverter2.cs
- ReflectPropertyDescriptor.cs
- StylusTip.cs