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 / Validation / ViewCellRelation.cs / 1 / ViewCellRelation.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Collections.Generic;
using System.Data.Mapping.ViewGeneration.Structures;
using System.Text;
using System.Data.Common.Utils;
namespace System.Data.Mapping.ViewGeneration.Validation {
///
/// Represents a relation signature that lists all projected
/// slots of two cell queries in a cell after projection. So if
/// SPerson1.Disc is present in the cellquery (and part of the where
/// clause) but not in the projected slots, it is missing from a ViewCellRelation
///
internal class ViewCellRelation : CellRelation {
#region Constructor
// effects: Creates a view cell relation for "cell" with the
// projected slots given by slots -- cellNumber is the number of the
// cell for debugging purposes
// Also creates the BasicCellRelations for the left and right cell queries
internal ViewCellRelation(Cell cell, List slots, int cellNumber) : base(cellNumber) {
m_cell = cell;
m_slots = slots;
// We create the basiccellrelations passing this to it so that we have
// a reference from the basiccellrelations to this
m_cell.CQuery.CreateBasicCellRelation(this);
m_cell.SQuery.CreateBasicCellRelation(this);
}
#endregion
#region Fields
private Cell m_cell; // The cell for which this relation exists
private List m_slots; // Slots projected from both cell queries
#endregion
#region Properties
internal Cell Cell {
get { return m_cell; }
}
#endregion
#region Methods
// requires: slot corresponds to a slot in the corresponding
// BasicCellRelation
// effects: Given a slot in the corresponding basicCellRelation,
// looks up the slot in this viewcellrelation and returns it. Returns
// null if it does not find the slot in the left or right side of the viewrelation
internal ViewCellSlot LookupViewSlot(JoinTreeSlot slot) {
// CHANGE_[....]_IMPROVE: We could have a dictionary to speed this up
foreach (ViewCellSlot viewSlot in m_slots) {
// If the left or right slots are equal, return the viewSlot
if (ProjectedSlot.EqualityComparer.Equals(slot, viewSlot.CSlot) ||
ProjectedSlot.EqualityComparer.Equals(slot, viewSlot.SSlot)) {
return viewSlot;
}
}
return null;
}
protected override int GetHash() {
// Note: Using CLR-Hashcode
return m_cell.GetHashCode();
// We need not hash the slots, etc - cell should give us enough
// differentiation and land the relation into the same bucket
}
internal override void ToCompactString(StringBuilder builder) {
builder.Append("ViewRel[");
m_cell.ToCompactString(builder);
// StringUtil.ToSeparatedStringSorted(builder, m_slots, ", ");
builder.Append(']');
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Collections.Generic;
using System.Data.Mapping.ViewGeneration.Structures;
using System.Text;
using System.Data.Common.Utils;
namespace System.Data.Mapping.ViewGeneration.Validation {
///
/// Represents a relation signature that lists all projected
/// slots of two cell queries in a cell after projection. So if
/// SPerson1.Disc is present in the cellquery (and part of the where
/// clause) but not in the projected slots, it is missing from a ViewCellRelation
///
internal class ViewCellRelation : CellRelation {
#region Constructor
// effects: Creates a view cell relation for "cell" with the
// projected slots given by slots -- cellNumber is the number of the
// cell for debugging purposes
// Also creates the BasicCellRelations for the left and right cell queries
internal ViewCellRelation(Cell cell, List slots, int cellNumber) : base(cellNumber) {
m_cell = cell;
m_slots = slots;
// We create the basiccellrelations passing this to it so that we have
// a reference from the basiccellrelations to this
m_cell.CQuery.CreateBasicCellRelation(this);
m_cell.SQuery.CreateBasicCellRelation(this);
}
#endregion
#region Fields
private Cell m_cell; // The cell for which this relation exists
private List m_slots; // Slots projected from both cell queries
#endregion
#region Properties
internal Cell Cell {
get { return m_cell; }
}
#endregion
#region Methods
// requires: slot corresponds to a slot in the corresponding
// BasicCellRelation
// effects: Given a slot in the corresponding basicCellRelation,
// looks up the slot in this viewcellrelation and returns it. Returns
// null if it does not find the slot in the left or right side of the viewrelation
internal ViewCellSlot LookupViewSlot(JoinTreeSlot slot) {
// CHANGE_[....]_IMPROVE: We could have a dictionary to speed this up
foreach (ViewCellSlot viewSlot in m_slots) {
// If the left or right slots are equal, return the viewSlot
if (ProjectedSlot.EqualityComparer.Equals(slot, viewSlot.CSlot) ||
ProjectedSlot.EqualityComparer.Equals(slot, viewSlot.SSlot)) {
return viewSlot;
}
}
return null;
}
protected override int GetHash() {
// Note: Using CLR-Hashcode
return m_cell.GetHashCode();
// We need not hash the slots, etc - cell should give us enough
// differentiation and land the relation into the same bucket
}
internal override void ToCompactString(StringBuilder builder) {
builder.Append("ViewRel[");
m_cell.ToCompactString(builder);
// StringUtil.ToSeparatedStringSorted(builder, m_slots, ", ");
builder.Append(']');
}
#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
- InvalidDataException.cs
- ScriptControlDescriptor.cs
- ContentPresenter.cs
- NameObjectCollectionBase.cs
- ReaderOutput.cs
- Vector3DAnimationUsingKeyFrames.cs
- WebPartsPersonalizationAuthorization.cs
- JsonDeserializer.cs
- MenuTracker.cs
- AnimatedTypeHelpers.cs
- PropertySourceInfo.cs
- WebDisplayNameAttribute.cs
- ToolBarButton.cs
- TextViewBase.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- Inline.cs
- PropertyEmitterBase.cs
- BitmapSizeOptions.cs
- ScrollBar.cs
- EFAssociationProvider.cs
- SqlAggregateChecker.cs
- SafeBuffer.cs
- SequenceDesigner.cs
- ContextMenuAutomationPeer.cs
- PlatformNotSupportedException.cs
- ListItemCollection.cs
- ContentControl.cs
- CodeRemoveEventStatement.cs
- ConfigXmlComment.cs
- GenericUI.cs
- ellipse.cs
- EntityDataSource.cs
- ScriptBehaviorDescriptor.cs
- WebPartConnectionCollection.cs
- UrlMappingCollection.cs
- WebCategoryAttribute.cs
- WebControlAdapter.cs
- SQLGuidStorage.cs
- HttpCapabilitiesSectionHandler.cs
- InkCanvas.cs
- RuleSettingsCollection.cs
- CurrencyWrapper.cs
- DbConnectionPoolCounters.cs
- SqlDependency.cs
- RecordManager.cs
- DbgUtil.cs
- WebBrowserUriTypeConverter.cs
- MonthChangedEventArgs.cs
- StylusOverProperty.cs
- XsltCompileContext.cs
- VisualStateGroup.cs
- Hash.cs
- WsdlBuildProvider.cs
- TcpConnectionPoolSettings.cs
- XhtmlBasicValidatorAdapter.cs
- SoapInteropTypes.cs
- ObjectDataSourceMethodEditor.cs
- ReferencedCategoriesDocument.cs
- Oci.cs
- ToolboxItem.cs
- TextComposition.cs
- ProtectedProviderSettings.cs
- DispatcherOperation.cs
- Schema.cs
- BufferModesCollection.cs
- ScrollBar.cs
- XmlSchemaObjectCollection.cs
- XPathDocumentNavigator.cs
- MimeTypeMapper.cs
- EmptyStringExpandableObjectConverter.cs
- ReachPrintTicketSerializerAsync.cs
- StringWriter.cs
- AttributeInfo.cs
- PhysicalAddress.cs
- CharacterMetricsDictionary.cs
- HttpProfileGroupBase.cs
- DecimalAnimationUsingKeyFrames.cs
- PeerContact.cs
- PrintingPermission.cs
- PreProcessInputEventArgs.cs
- ServiceModelConfigurationElementCollection.cs
- DataSourceSelectArguments.cs
- JavaScriptString.cs
- XmlCountingReader.cs
- VisualCollection.cs
- WebControlParameterProxy.cs
- SqlFunctionAttribute.cs
- MDIWindowDialog.cs
- FormatVersion.cs
- XamlSerializerUtil.cs
- HtmlImage.cs
- HtmlTableCellCollection.cs
- GridViewSortEventArgs.cs
- CLRBindingWorker.cs
- StaticDataManager.cs
- ValidatingPropertiesEventArgs.cs
- WebResponse.cs
- ManagementOptions.cs
- PropertyGridCommands.cs