Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Map / ViewGeneration / Structures / WithStatement.cs / 1 / WithStatement.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Data.Common.Utils;
using System.Text;
using System.Collections.Generic;
using System.Data.Mapping.ViewGeneration.CqlGeneration;
using System.Data.Metadata.Edm;
using System.Diagnostics;
namespace System.Data.Mapping.ViewGeneration.Structures
{
// effects: A class to denote a With statement
internal class WithStatement : InternalBase
{
#region Constructors
///
/// effects: Creates a case statement for the field "memberPath"
/// with no clauses
///
internal WithStatement(EntitySet entitySetForToEnd, EntityType entityTypeForToEnd,
EntityType entityTypeForFromEnd, AssociationSet associationSet,
string fromRoleName, string toRoleName,
IEnumerable memberPathsForEndMembers)
{
m_entitySetForToEnd = entitySetForToEnd;
m_entityTypeForToEnd = entityTypeForToEnd;
m_entityTypeForFromEnd = entityTypeForFromEnd;
m_memberPathsForEndMembers = memberPathsForEndMembers;
m_associationSet = associationSet;
m_fromRoleName = fromRoleName;
m_toRoleName = toRoleName;
}
#endregion
#region Fields
private EntitySet m_entitySetForToEnd;
private EntityType m_entityTypeForToEnd;
private EntityType m_entityTypeForFromEnd;
private AssociationSet m_associationSet;
private string m_fromRoleName;
private string m_toRoleName;
private IEnumerable m_memberPathsForEndMembers;
#endregion
#region Properties
internal EntityType EntityTypeForFromEnd
{
get { return m_entityTypeForFromEnd; }
}
#endregion
#region Methods
// effects: For the given With Statement, generates the CQL for
// it.
internal StringBuilder AsCql(StringBuilder builder, string blockAlias, int indentLevel)
{
StringUtil.IndentNewLine(builder, indentLevel + 1);
builder.Append("RELATIONSHIP(");
List fields = new List();
// If the variable is a relation end, we will gets it scope Extent, e.g., CPerson1 for an
// the CPerson end of CPersonAddress1
builder.Append("CREATEREF(");
CqlWriter.AppendEscapedQualifiedName(builder, m_entitySetForToEnd.EntityContainer.Name, m_entitySetForToEnd.Name);
builder.Append(", ROW(");
foreach (MemberPath memberPath in m_memberPathsForEndMembers)
{
string fullFieldAlias = CqlWriter.GetQualifiedName(blockAlias, memberPath.CqlFieldAlias);
fields.Add(fullFieldAlias);
}
StringUtil.ToSeparatedString(builder, fields, ", ", null);
builder.Append(')');
builder.Append(",");
CqlWriter.AppendEscapedTypeName(builder, m_entityTypeForToEnd);
builder.Append(')');
builder.Append(',');
CqlWriter.AppendEscapedTypeName(builder, m_associationSet.ElementType);
builder.Append(',');
CqlWriter.AppendEscapedName(builder, m_fromRoleName);
builder.Append(',');
CqlWriter.AppendEscapedName(builder, m_toRoleName);
builder.Append(')');
builder.Append(' ');
return builder;
}
// Repeat of AsCql but don't have all the info
internal override void ToCompactString(StringBuilder builder)
{
throw new NotImplementedException();
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Data.Common.Utils;
using System.Text;
using System.Collections.Generic;
using System.Data.Mapping.ViewGeneration.CqlGeneration;
using System.Data.Metadata.Edm;
using System.Diagnostics;
namespace System.Data.Mapping.ViewGeneration.Structures
{
// effects: A class to denote a With statement
internal class WithStatement : InternalBase
{
#region Constructors
///
/// effects: Creates a case statement for the field "memberPath"
/// with no clauses
///
internal WithStatement(EntitySet entitySetForToEnd, EntityType entityTypeForToEnd,
EntityType entityTypeForFromEnd, AssociationSet associationSet,
string fromRoleName, string toRoleName,
IEnumerable memberPathsForEndMembers)
{
m_entitySetForToEnd = entitySetForToEnd;
m_entityTypeForToEnd = entityTypeForToEnd;
m_entityTypeForFromEnd = entityTypeForFromEnd;
m_memberPathsForEndMembers = memberPathsForEndMembers;
m_associationSet = associationSet;
m_fromRoleName = fromRoleName;
m_toRoleName = toRoleName;
}
#endregion
#region Fields
private EntitySet m_entitySetForToEnd;
private EntityType m_entityTypeForToEnd;
private EntityType m_entityTypeForFromEnd;
private AssociationSet m_associationSet;
private string m_fromRoleName;
private string m_toRoleName;
private IEnumerable m_memberPathsForEndMembers;
#endregion
#region Properties
internal EntityType EntityTypeForFromEnd
{
get { return m_entityTypeForFromEnd; }
}
#endregion
#region Methods
// effects: For the given With Statement, generates the CQL for
// it.
internal StringBuilder AsCql(StringBuilder builder, string blockAlias, int indentLevel)
{
StringUtil.IndentNewLine(builder, indentLevel + 1);
builder.Append("RELATIONSHIP(");
List fields = new List();
// If the variable is a relation end, we will gets it scope Extent, e.g., CPerson1 for an
// the CPerson end of CPersonAddress1
builder.Append("CREATEREF(");
CqlWriter.AppendEscapedQualifiedName(builder, m_entitySetForToEnd.EntityContainer.Name, m_entitySetForToEnd.Name);
builder.Append(", ROW(");
foreach (MemberPath memberPath in m_memberPathsForEndMembers)
{
string fullFieldAlias = CqlWriter.GetQualifiedName(blockAlias, memberPath.CqlFieldAlias);
fields.Add(fullFieldAlias);
}
StringUtil.ToSeparatedString(builder, fields, ", ", null);
builder.Append(')');
builder.Append(",");
CqlWriter.AppendEscapedTypeName(builder, m_entityTypeForToEnd);
builder.Append(')');
builder.Append(',');
CqlWriter.AppendEscapedTypeName(builder, m_associationSet.ElementType);
builder.Append(',');
CqlWriter.AppendEscapedName(builder, m_fromRoleName);
builder.Append(',');
CqlWriter.AppendEscapedName(builder, m_toRoleName);
builder.Append(')');
builder.Append(' ');
return builder;
}
// Repeat of AsCql but don't have all the info
internal override void ToCompactString(StringBuilder builder)
{
throw new NotImplementedException();
}
#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
- Matrix3D.cs
- MetaTableHelper.cs
- ButtonBaseAutomationPeer.cs
- X509Certificate.cs
- PackWebRequest.cs
- BackStopAuthenticationModule.cs
- DirtyTextRange.cs
- HtmlLink.cs
- BulletChrome.cs
- parserscommon.cs
- ParseChildrenAsPropertiesAttribute.cs
- ValueUtilsSmi.cs
- CqlParserHelpers.cs
- AstTree.cs
- XPathAncestorIterator.cs
- DNS.cs
- SqlXml.cs
- Effect.cs
- TextRange.cs
- LocalFileSettingsProvider.cs
- TextSchema.cs
- FormViewInsertEventArgs.cs
- XmlAttributeHolder.cs
- XmlCompatibilityReader.cs
- PriorityBinding.cs
- RequestCacheValidator.cs
- FileVersionInfo.cs
- ObjectStateEntry.cs
- StorageFunctionMapping.cs
- DecoderExceptionFallback.cs
- BlockExpression.cs
- InputScope.cs
- XmlDataDocument.cs
- Tokenizer.cs
- CodeSnippetExpression.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- Clause.cs
- StylusTip.cs
- Config.cs
- BufferModesCollection.cs
- TargetControlTypeAttribute.cs
- SafeProcessHandle.cs
- XpsSerializationManagerAsync.cs
- DataGridViewRowHeaderCell.cs
- StructureChangedEventArgs.cs
- AssemblyInfo.cs
- XPathNodeList.cs
- ListBoxItemWrapperAutomationPeer.cs
- TriState.cs
- SAPICategories.cs
- DataStorage.cs
- ToolStripPanel.cs
- PageWrapper.cs
- RotateTransform3D.cs
- XmlnsDefinitionAttribute.cs
- GridViewCellAutomationPeer.cs
- DocumentViewerAutomationPeer.cs
- AppSettingsExpressionBuilder.cs
- Module.cs
- KeyValuePair.cs
- FormsAuthenticationTicket.cs
- SortExpressionBuilder.cs
- MultilineStringConverter.cs
- dtdvalidator.cs
- OrCondition.cs
- PrintDialog.cs
- FlowDocumentPageViewerAutomationPeer.cs
- UrlMappingCollection.cs
- PolyQuadraticBezierSegment.cs
- Group.cs
- versioninfo.cs
- Floater.cs
- ApplicationServiceManager.cs
- XmlStreamStore.cs
- HtmlAnchor.cs
- DataGridItemCollection.cs
- MiniParameterInfo.cs
- VarRefManager.cs
- DesignTimeHTMLTextWriter.cs
- unsafenativemethodstextservices.cs
- WmlPageAdapter.cs
- filewebresponse.cs
- DefinitionUpdate.cs
- AutoResizedEvent.cs
- ApplicationInfo.cs
- Serializer.cs
- MethodResolver.cs
- Policy.cs
- StateInitializationDesigner.cs
- TcpTransportSecurity.cs
- ActivityMetadata.cs
- AxisAngleRotation3D.cs
- DataPointer.cs
- MatrixConverter.cs
- IERequestCache.cs
- RemoteX509Token.cs
- GeometryModel3D.cs
- TypeLibConverter.cs
- ReadOnlyPropertyMetadata.cs
- ToolStripRenderer.cs