Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Map / ViewGeneration / Validation / ViewCellSlot.cs / 1305376 / ViewCellSlot.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; using System.Data.Mapping.ViewGeneration.Utils; using System.Data.Entity; using System.Diagnostics; namespace System.Data.Mapping.ViewGeneration.Validation { // Represents a slot that is projected by both cell queries in a cell internal class ViewCellSlot : ProjectedSlot { #region Constructor // effects: Creates a view cell slot that corresponds to slot number // "slotNum" in some cell -- the leftSlot and rightSlot represent the // slots in the left and right cellqueries at slot slotNum internal ViewCellSlot(int slotNum, MemberProjectedSlot cSlot, MemberProjectedSlot sSlot) { m_slotNum = slotNum; m_cSlot = cSlot; m_sSlot = sSlot; } #endregion #region Fields private int m_slotNum; private MemberProjectedSlot m_cSlot; private MemberProjectedSlot m_sSlot; // A comparer that can compare ViewCellSlots only (and not generic ProjectedSlots) internal static readonly IEqualityComparerSpecificEqualityComparer = new ViewCellSlotEqualityComparer(); #endregion #region Properties // effects: Returns the slot corresponding to the left cellquery internal MemberProjectedSlot CSlot { get { return m_cSlot; } } // effects: Returns the slot corresponding to the right cellquery internal MemberProjectedSlot SSlot { get { return m_sSlot; } } #endregion #region Comparer/String Methods protected override bool IsEqualTo(ProjectedSlot right) { ViewCellSlot rightSlot = right as ViewCellSlot; if (rightSlot == null) { return false; } return m_slotNum == rightSlot.m_slotNum && MemberProjectedSlot.EqualityComparer.Equals(m_cSlot, rightSlot.m_cSlot) && MemberProjectedSlot.EqualityComparer.Equals(m_sSlot, rightSlot.m_sSlot); } protected override int GetHash() { return MemberProjectedSlot.EqualityComparer.GetHashCode(m_cSlot) ^ MemberProjectedSlot.EqualityComparer.GetHashCode(m_sSlot) ^ m_slotNum; } // effects: Given a list of slots, converts the left/right slots (if left // is true/false) to a human-readable string internal static string SlotsToUserString(IEnumerable slots, bool isFromCside) { StringBuilder builder = new StringBuilder(); bool first = true; foreach (ViewCellSlot slot in slots) { if (false == first) { builder.Append(", "); } builder.Append(SlotToUserString(slot, isFromCside)); first = false; } return builder.ToString(); } internal static string SlotToUserString(ViewCellSlot slot, bool isFromCside) { MemberProjectedSlot actualSlot = isFromCside ? slot.CSlot : slot.SSlot; string result = StringUtil.FormatInvariant("{0}", actualSlot); return result; } internal override StringBuilder AsCql(StringBuilder builder, MemberPath outputMember, string blockAlias, int indentLevel) { Debug.Fail("Should not be called."); return null; // To keep the compiler happy } internal override void ToCompactString(StringBuilder builder) { builder.Append('<'); StringUtil.FormatStringBuilder(builder, "{0}", m_slotNum); builder.Append(':'); m_cSlot.ToCompactString(builder); builder.Append('-'); m_sSlot.ToCompactString(builder); builder.Append('>'); } #endregion #region ViewCellSlot Comparer class // Simply delegate the work to the ProjectedSlot.EqualityComparer internal class ViewCellSlotEqualityComparer : IEqualityComparer { public bool Equals(ViewCellSlot left, ViewCellSlot right) { return ProjectedSlot.EqualityComparer.Equals(left, right); } public int GetHashCode(ViewCellSlot key) { return ProjectedSlot.EqualityComparer.GetHashCode(key); } } #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
- TextServicesContext.cs
- RuleInfoComparer.cs
- errorpatternmatcher.cs
- SamlEvidence.cs
- EdmProperty.cs
- NavigationWindow.cs
- BrowserInteropHelper.cs
- Line.cs
- LogicalTreeHelper.cs
- QilList.cs
- RegexNode.cs
- XpsException.cs
- QueryTask.cs
- HeaderedItemsControl.cs
- ButtonChrome.cs
- RIPEMD160.cs
- XamlSerializationHelper.cs
- ShaderEffect.cs
- AutoSizeComboBox.cs
- NativeMethods.cs
- MessageQueueConverter.cs
- Guid.cs
- BaseCollection.cs
- HttpFileCollection.cs
- IsolatedStorageFilePermission.cs
- RecordsAffectedEventArgs.cs
- PreloadedPackages.cs
- RegexCode.cs
- MouseEvent.cs
- ObjectQuery.cs
- BufferModesCollection.cs
- ListMarkerSourceInfo.cs
- CompilerInfo.cs
- Configuration.cs
- RawStylusInputReport.cs
- HtmlInputImage.cs
- ScriptResourceInfo.cs
- hresults.cs
- LoadGrammarCompletedEventArgs.cs
- URI.cs
- WebExceptionStatus.cs
- SqlLiftIndependentRowExpressions.cs
- SafeNativeMethods.cs
- Variable.cs
- VoiceObjectToken.cs
- ImageMetadata.cs
- QilStrConcatenator.cs
- ToolStripPanelCell.cs
- WindowsFormsHostPropertyMap.cs
- ActiveXHelper.cs
- DataServiceQueryOfT.cs
- SystemDropShadowChrome.cs
- FacetChecker.cs
- Part.cs
- LambdaCompiler.ControlFlow.cs
- ReadOnlyDictionary.cs
- EncoderExceptionFallback.cs
- SplayTreeNode.cs
- SerialErrors.cs
- MoveSizeWinEventHandler.cs
- SecureConversationSecurityTokenParameters.cs
- DataKey.cs
- Endpoint.cs
- DataContractSerializerSection.cs
- SkipQueryOptionExpression.cs
- RemotingAttributes.cs
- CornerRadiusConverter.cs
- TrackingLocation.cs
- Wizard.cs
- RowToParametersTransformer.cs
- FileDataSourceCache.cs
- Parameter.cs
- ShaderEffect.cs
- Label.cs
- BuildResultCache.cs
- HttpHandler.cs
- PrintDialogException.cs
- ScaleTransform3D.cs
- ProfileProvider.cs
- SystemIcons.cs
- TreeNode.cs
- WorkflowShape.cs
- TypeDescriptorContext.cs
- EnumValAlphaComparer.cs
- Msec.cs
- RegisteredArrayDeclaration.cs
- ScalarOps.cs
- WindowsPen.cs
- FtpRequestCacheValidator.cs
- OptimalBreakSession.cs
- LinkLabel.cs
- IssuanceLicense.cs
- OutputCacheProfileCollection.cs
- CallbackValidatorAttribute.cs
- OdbcException.cs
- ListViewItem.cs
- MultilineStringConverter.cs
- ComponentSerializationService.cs
- DictionaryEditChange.cs
- CodeIdentifier.cs