Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Map / ViewGeneration / CqlGeneration / AliasedSlot.cs / 2 / AliasedSlot.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Data.Mapping.ViewGeneration.Structures;
using System.Text;
using System.Diagnostics;
using System.Data.Common.Utils;
using System.Collections.Generic;
namespace System.Data.Mapping.ViewGeneration.CqlGeneration {
// A slot that encapsulates a slot in a particular CqlBlock
internal class AliasedSlot : ProjectedSlot {
#region Constructor
// effects: Creates an alias slot "block.slot" whose output member
// path is memberPath - this can be null for boolean slots. slotNum
// is the slot number in block to which this slot refers to
internal AliasedSlot(CqlBlock block, ProjectedSlot slot, MemberPath memberPath, int slotNum) {
Debug.Assert(block != null && slot != null, "Null input to AliasedSlot constructor");
Debug.Assert(slot is AliasedSlot || (slot is BooleanProjectedSlot ) == (memberPath == null),
"If slot is boolean slot, there is no member path for it and vice-versa");
m_block = block;
// Note slot can be another aliased slot
m_slot = slot;
m_memberPath = memberPath;
// Make sure that the aliased slot is projected
Debug.Assert(block.IsProjected(slotNum), "Aliased slot " + this + " not being projected " +
"in child block ");
}
#endregion
#region Fields
private CqlBlock m_block;
private ProjectedSlot m_slot;
private MemberPath m_memberPath;
#endregion
#region Properties
internal MemberPath MemberPath
{
get { return m_memberPath; }
}
internal CqlBlock Block
{
get { return m_block; }
}
internal ProjectedSlot InnerSlot
{
get { return m_slot; }
}
#endregion
#region Methods
internal override ProjectedSlot MakeAliasedSlot(CqlBlock block, MemberPath outputPath, int slotNum) {
// We take the slot inside this and change the block
Debug.Assert(MemberPath.EqualityComparer.Equals(m_memberPath, outputPath),
"Different output paths for aliased slot and next use of it higher up in tree");
AliasedSlot result = new AliasedSlot(block, m_slot, outputPath, slotNum);
return result;
}
internal string FullCqlAlias() {
return CqlWriter.GetQualifiedName(m_block.CqlAlias, CqlFieldAlias(m_memberPath));
}
internal override string CqlFieldAlias(MemberPath outputMember) {
// effects: Returns The alias corresponding to this slot, e.g.,
// _from0 or CPerson1_pid
Debug.Assert(MemberPath.EqualityComparer.Equals(outputMember, m_memberPath),
"Aliased slot's idea of what the output is different from the Cql block's idea");
ProjectedSlot slot = m_slot;
// Keep looking inside the aliased slot till we find a
// non-aliased slot and then get the alias name for it
// For cycle detection
Set slotSet = new Set();
while (true) {
Debug.Assert(false == slotSet.Contains(slot), "Cycle detected in aliased slot");
slotSet.Add(slot);
AliasedSlot aliasedSlot = slot as AliasedSlot;
if (aliasedSlot == null) {
break;
}
slot = aliasedSlot.m_slot;
}
string result = slot.CqlFieldAlias(m_memberPath);
return result;
}
internal override StringBuilder AsCql(StringBuilder builder, MemberPath outputMember,
string blockAlias, int indentLevel) {
// Ignore table alias and just get the full alias name
builder.Append(FullCqlAlias());
return builder;
}
internal override void ToCompactString(StringBuilder builder) {
StringUtil.FormatStringBuilder(builder, "{0} ", m_block.CqlAlias);
m_slot.ToCompactString(builder);
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Data.Mapping.ViewGeneration.Structures;
using System.Text;
using System.Diagnostics;
using System.Data.Common.Utils;
using System.Collections.Generic;
namespace System.Data.Mapping.ViewGeneration.CqlGeneration {
// A slot that encapsulates a slot in a particular CqlBlock
internal class AliasedSlot : ProjectedSlot {
#region Constructor
// effects: Creates an alias slot "block.slot" whose output member
// path is memberPath - this can be null for boolean slots. slotNum
// is the slot number in block to which this slot refers to
internal AliasedSlot(CqlBlock block, ProjectedSlot slot, MemberPath memberPath, int slotNum) {
Debug.Assert(block != null && slot != null, "Null input to AliasedSlot constructor");
Debug.Assert(slot is AliasedSlot || (slot is BooleanProjectedSlot ) == (memberPath == null),
"If slot is boolean slot, there is no member path for it and vice-versa");
m_block = block;
// Note slot can be another aliased slot
m_slot = slot;
m_memberPath = memberPath;
// Make sure that the aliased slot is projected
Debug.Assert(block.IsProjected(slotNum), "Aliased slot " + this + " not being projected " +
"in child block ");
}
#endregion
#region Fields
private CqlBlock m_block;
private ProjectedSlot m_slot;
private MemberPath m_memberPath;
#endregion
#region Properties
internal MemberPath MemberPath
{
get { return m_memberPath; }
}
internal CqlBlock Block
{
get { return m_block; }
}
internal ProjectedSlot InnerSlot
{
get { return m_slot; }
}
#endregion
#region Methods
internal override ProjectedSlot MakeAliasedSlot(CqlBlock block, MemberPath outputPath, int slotNum) {
// We take the slot inside this and change the block
Debug.Assert(MemberPath.EqualityComparer.Equals(m_memberPath, outputPath),
"Different output paths for aliased slot and next use of it higher up in tree");
AliasedSlot result = new AliasedSlot(block, m_slot, outputPath, slotNum);
return result;
}
internal string FullCqlAlias() {
return CqlWriter.GetQualifiedName(m_block.CqlAlias, CqlFieldAlias(m_memberPath));
}
internal override string CqlFieldAlias(MemberPath outputMember) {
// effects: Returns The alias corresponding to this slot, e.g.,
// _from0 or CPerson1_pid
Debug.Assert(MemberPath.EqualityComparer.Equals(outputMember, m_memberPath),
"Aliased slot's idea of what the output is different from the Cql block's idea");
ProjectedSlot slot = m_slot;
// Keep looking inside the aliased slot till we find a
// non-aliased slot and then get the alias name for it
// For cycle detection
Set slotSet = new Set();
while (true) {
Debug.Assert(false == slotSet.Contains(slot), "Cycle detected in aliased slot");
slotSet.Add(slot);
AliasedSlot aliasedSlot = slot as AliasedSlot;
if (aliasedSlot == null) {
break;
}
slot = aliasedSlot.m_slot;
}
string result = slot.CqlFieldAlias(m_memberPath);
return result;
}
internal override StringBuilder AsCql(StringBuilder builder, MemberPath outputMember,
string blockAlias, int indentLevel) {
// Ignore table alias and just get the full alias name
builder.Append(FullCqlAlias());
return builder;
}
internal override void ToCompactString(StringBuilder builder) {
StringUtil.FormatStringBuilder(builder, "{0} ", m_block.CqlAlias);
m_slot.ToCompactString(builder);
}
#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
- AmbientLight.cs
- ListViewItemEventArgs.cs
- TextLine.cs
- SettingsPropertyValue.cs
- BaseUriWithWildcard.cs
- ColumnHeaderConverter.cs
- DataStreams.cs
- EdmTypeAttribute.cs
- SchemaImporterExtensionsSection.cs
- SizeChangedInfo.cs
- Attributes.cs
- HttpServerVarsCollection.cs
- TileBrush.cs
- VectorCollectionValueSerializer.cs
- ReferencedCollectionType.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- GetBrowserTokenRequest.cs
- DesignConnectionCollection.cs
- DrawTreeNodeEventArgs.cs
- ComplexBindingPropertiesAttribute.cs
- OLEDB_Util.cs
- EntityDataSourceColumn.cs
- TreeViewAutomationPeer.cs
- MdImport.cs
- UnknownWrapper.cs
- PropertyChangingEventArgs.cs
- DelegateHelpers.Generated.cs
- GenericQueueSurrogate.cs
- MetadataCollection.cs
- GZipStream.cs
- Membership.cs
- SafeTokenHandle.cs
- Trace.cs
- WrappedIUnknown.cs
- Root.cs
- SyndicationItemFormatter.cs
- DataListGeneralPage.cs
- MULTI_QI.cs
- OperandQuery.cs
- ConfigurationStrings.cs
- RequestSecurityToken.cs
- TabControlEvent.cs
- versioninfo.cs
- TraceShell.cs
- Pkcs9Attribute.cs
- IndentTextWriter.cs
- LogLogRecord.cs
- MarkupCompiler.cs
- LocatorPart.cs
- SigningCredentials.cs
- SplineKeyFrames.cs
- UnsignedPublishLicense.cs
- WebControlAdapter.cs
- ISAPIWorkerRequest.cs
- QueryCursorEventArgs.cs
- SqlUserDefinedTypeAttribute.cs
- BitStream.cs
- SqlUserDefinedTypeAttribute.cs
- ApplicationBuildProvider.cs
- ProgressBar.cs
- VideoDrawing.cs
- ManagedWndProcTracker.cs
- HtmlControlDesigner.cs
- BindingWorker.cs
- FixedSOMTableRow.cs
- SerialPort.cs
- DocumentGrid.cs
- FileLoadException.cs
- DynamicResourceExtensionConverter.cs
- DynamicDataManager.cs
- DPCustomTypeDescriptor.cs
- MsmqTransportSecurityElement.cs
- Help.cs
- BezierSegment.cs
- ControlCollection.cs
- ApplyTemplatesAction.cs
- CoTaskMemUnicodeSafeHandle.cs
- IncomingWebResponseContext.cs
- DataControlFieldCollection.cs
- WindowsAuthenticationModule.cs
- FormatConvertedBitmap.cs
- DataBindEngine.cs
- SoapSchemaMember.cs
- WebPartConnectionsConfigureVerb.cs
- RowToFieldTransformer.cs
- EqualityArray.cs
- X509WindowsSecurityToken.cs
- WebUtil.cs
- Pkcs7Recipient.cs
- WebMessageFormatHelper.cs
- RichTextBox.cs
- dataprotectionpermission.cs
- RectangleF.cs
- SpeakProgressEventArgs.cs
- EntityDescriptor.cs
- RuntimeIdentifierPropertyAttribute.cs
- AppDomain.cs
- UserControlBuildProvider.cs
- ObjectViewQueryResultData.cs
- SchemaAttDef.cs