Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Map / ViewGeneration / Structures / CellIdBoolean.cs / 2 / CellIdBoolean.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Data.Common.Utils.Boolean;
using System.Text;
using System.Collections.Generic;
using System.Data.Common.Utils;
using System.Data.Mapping.ViewGeneration.CqlGeneration;
using System.Data.Mapping.ViewGeneration.Utils;
namespace System.Data.Mapping.ViewGeneration.Structures {
using DomainBoolExpr = BoolExpr>;
using DomainNotExpr = NotExpr>;
using DomainTermExpr = TermExpr>;
using System.Data.Entity;
///
/// Wraps from0, from1, etc. boolean fields that identify
/// the source of tuples (# of respective cell query) in the view statements
///
internal class CellIdBoolean : TrueFalseLiteral {
#region Constructor
// effects: Creates a boolean expression for the variable name
// specified by "index", e.g., 0 results in from0, 1 into from1
internal CellIdBoolean(CqlIdentifiers identifiers, int index) {
m_identifiers = identifiers;
m_index = index;
}
#endregion
#region Fields
private int m_index; // e.g., from0, from1
private CqlIdentifiers m_identifiers; // Whether the prefix should be _from or something more complicated due to collisions
#endregion
#region Properties
// effects: Returns the slotName corresponding to this, ie., _from0 etc
internal string SlotName {
get {
string result = m_identifiers.GetFromVariable(m_index);
return result;
}
}
#endregion
#region BoolLiteral members
internal override StringBuilder AsCql(StringBuilder builder, string blockAlias, bool canSkipIsNotNull) {
// Get e.g., T2._from1 using the table alias
string qualifiedName = CqlWriter.GetQualifiedName(blockAlias, SlotName);
builder.Append(qualifiedName);
return builder;
}
internal override StringBuilder AsUserString(StringBuilder builder, string blockAlias, bool canSkipIsNotNull)
{
return AsCql(builder, blockAlias, canSkipIsNotNull);
}
internal override StringBuilder AsNegatedUserString(StringBuilder builder, string blockAlias, bool canSkipIsNotNull)
{
builder.Append("NOT(");
builder = AsUserString(builder, blockAlias, canSkipIsNotNull);
builder.Append(")");
return builder;
}
internal override void GetRequiredSlots(MemberPathMapBase projectedSlotMap, bool[] requiredSlots) {
// The slot corresponding to from1, etc
int numBoolSlots = requiredSlots.Length - projectedSlotMap.Count;
int slotNum = ProjectedSlot.BoolIndexToSlot(m_index, projectedSlotMap, numBoolSlots);
requiredSlots[slotNum] = true;
}
protected override bool IsEqualTo(BoolLiteral right) {
CellIdBoolean rightBoolean = right as CellIdBoolean;
if (rightBoolean == null) {
return false;
}
return m_index == rightBoolean.m_index;
}
protected override int GetHash() {
return m_index.GetHashCode();
}
// effects: See BoolExpression.RemapBool
internal override BoolLiteral RemapBool(Dictionary remap) {
return this;
}
internal override bool CheckRepInvariant() {
ExceptionHelpers.CheckAndThrowRes(m_index >= 0, () => Strings.ViewGen_CellIdBooleans_Invalid);
return true;
}
#endregion
#region Other Methods
internal override void ToCompactString(StringBuilder builder) {
builder.Append(SlotName);
}
#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.Boolean;
using System.Text;
using System.Collections.Generic;
using System.Data.Common.Utils;
using System.Data.Mapping.ViewGeneration.CqlGeneration;
using System.Data.Mapping.ViewGeneration.Utils;
namespace System.Data.Mapping.ViewGeneration.Structures {
using DomainBoolExpr = BoolExpr>;
using DomainNotExpr = NotExpr>;
using DomainTermExpr = TermExpr>;
using System.Data.Entity;
///
/// Wraps from0, from1, etc. boolean fields that identify
/// the source of tuples (# of respective cell query) in the view statements
///
internal class CellIdBoolean : TrueFalseLiteral {
#region Constructor
// effects: Creates a boolean expression for the variable name
// specified by "index", e.g., 0 results in from0, 1 into from1
internal CellIdBoolean(CqlIdentifiers identifiers, int index) {
m_identifiers = identifiers;
m_index = index;
}
#endregion
#region Fields
private int m_index; // e.g., from0, from1
private CqlIdentifiers m_identifiers; // Whether the prefix should be _from or something more complicated due to collisions
#endregion
#region Properties
// effects: Returns the slotName corresponding to this, ie., _from0 etc
internal string SlotName {
get {
string result = m_identifiers.GetFromVariable(m_index);
return result;
}
}
#endregion
#region BoolLiteral members
internal override StringBuilder AsCql(StringBuilder builder, string blockAlias, bool canSkipIsNotNull) {
// Get e.g., T2._from1 using the table alias
string qualifiedName = CqlWriter.GetQualifiedName(blockAlias, SlotName);
builder.Append(qualifiedName);
return builder;
}
internal override StringBuilder AsUserString(StringBuilder builder, string blockAlias, bool canSkipIsNotNull)
{
return AsCql(builder, blockAlias, canSkipIsNotNull);
}
internal override StringBuilder AsNegatedUserString(StringBuilder builder, string blockAlias, bool canSkipIsNotNull)
{
builder.Append("NOT(");
builder = AsUserString(builder, blockAlias, canSkipIsNotNull);
builder.Append(")");
return builder;
}
internal override void GetRequiredSlots(MemberPathMapBase projectedSlotMap, bool[] requiredSlots) {
// The slot corresponding to from1, etc
int numBoolSlots = requiredSlots.Length - projectedSlotMap.Count;
int slotNum = ProjectedSlot.BoolIndexToSlot(m_index, projectedSlotMap, numBoolSlots);
requiredSlots[slotNum] = true;
}
protected override bool IsEqualTo(BoolLiteral right) {
CellIdBoolean rightBoolean = right as CellIdBoolean;
if (rightBoolean == null) {
return false;
}
return m_index == rightBoolean.m_index;
}
protected override int GetHash() {
return m_index.GetHashCode();
}
// effects: See BoolExpression.RemapBool
internal override BoolLiteral RemapBool(Dictionary remap) {
return this;
}
internal override bool CheckRepInvariant() {
ExceptionHelpers.CheckAndThrowRes(m_index >= 0, () => Strings.ViewGen_CellIdBooleans_Invalid);
return true;
}
#endregion
#region Other Methods
internal override void ToCompactString(StringBuilder builder) {
builder.Append(SlotName);
}
#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
- IdentityHolder.cs
- Socket.cs
- WindowsListViewGroupHelper.cs
- FixedSOMElement.cs
- PropertyIdentifier.cs
- AlignmentYValidation.cs
- FixedDocument.cs
- localization.cs
- ServicesSection.cs
- XmlFormatWriterGenerator.cs
- ProcessStartInfo.cs
- initElementDictionary.cs
- AspNetHostingPermission.cs
- MsmqTransportSecurityElement.cs
- ContainerControl.cs
- XmlCustomFormatter.cs
- PerspectiveCamera.cs
- PropertyStore.cs
- MappingItemCollection.cs
- ManualResetEvent.cs
- QilSortKey.cs
- DataGridViewBindingCompleteEventArgs.cs
- XmlHierarchyData.cs
- XmlExtensionFunction.cs
- WebPartEditorOkVerb.cs
- ListenerSingletonConnectionReader.cs
- ConfigurationStrings.cs
- DbProviderFactory.cs
- externdll.cs
- InputProviderSite.cs
- XamlBrushSerializer.cs
- odbcmetadatacolumnnames.cs
- DllNotFoundException.cs
- CompiledELinqQueryState.cs
- SqlDataSource.cs
- MenuItemBinding.cs
- UTF32Encoding.cs
- Journal.cs
- XmlSerializerAssemblyAttribute.cs
- LinkConverter.cs
- Baml2006KeyRecord.cs
- SimpleWorkerRequest.cs
- MediaElementAutomationPeer.cs
- PersonalizationDictionary.cs
- WebHostUnsafeNativeMethods.cs
- DetailsViewUpdateEventArgs.cs
- DbParameterCollectionHelper.cs
- SQLDouble.cs
- UndirectedGraph.cs
- WindowsTitleBar.cs
- WorkflowRuntimeServiceElement.cs
- MruCache.cs
- SamlAttribute.cs
- regiisutil.cs
- Vector3DCollectionConverter.cs
- UITypeEditor.cs
- AnnouncementInnerClientCD1.cs
- X509ChainPolicy.cs
- TextTreeUndo.cs
- SamlEvidence.cs
- FixedStringLookup.cs
- SystemIPGlobalStatistics.cs
- WhereQueryOperator.cs
- FlowDocumentPage.cs
- FixedSOMLineRanges.cs
- XmlReaderDelegator.cs
- QilBinary.cs
- OperandQuery.cs
- AccessedThroughPropertyAttribute.cs
- ProtectedProviderSettings.cs
- ExtensionSurface.cs
- SapiRecoContext.cs
- Column.cs
- SystemDropShadowChrome.cs
- ClientCredentials.cs
- PackWebRequestFactory.cs
- EdmItemCollection.cs
- FunctionUpdateCommand.cs
- WindowsPen.cs
- NodeInfo.cs
- DesignerOptionService.cs
- ConstrainedDataObject.cs
- LinqDataSourceInsertEventArgs.cs
- BasicAsyncResult.cs
- WebReferenceOptions.cs
- EntityDataSourceSelectedEventArgs.cs
- XmlQualifiedNameTest.cs
- StringCollection.cs
- RelatedEnd.cs
- FlagsAttribute.cs
- DataGridTableCollection.cs
- IIS7WorkerRequest.cs
- EntityClientCacheEntry.cs
- QueryOutputWriter.cs
- QuaternionConverter.cs
- RenderDataDrawingContext.cs
- DynamicResourceExtension.cs
- InvalidPipelineStoreException.cs
- WindowVisualStateTracker.cs
- TransactedBatchingBehavior.cs