Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / LinkDescriptor.cs / 1305376 / LinkDescriptor.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// represents the association between two entities // //--------------------------------------------------------------------- namespace System.Data.Services.Client { using System.Diagnostics; ////// represents the association between two entities /// [DebuggerDisplay("State = {state}")] public sealed class LinkDescriptor : Descriptor { #region Fields ///equivalence comparer internal static readonly System.Collections.Generic.IEqualityComparerEquivalenceComparer = new Equivalent(); /// source entity private object source; ///name of property on source entity that references the target entity private string sourceProperty; ///target entity private object target; #endregion ////// Constructor /// /// Source entity /// Navigation property on the source entity /// Target entity internal LinkDescriptor(object source, string sourceProperty, object target) : this(source, sourceProperty, target, EntityStates.Unchanged) { } ////// Constructor /// /// Source entity /// Navigation property on the source entity /// Target entity /// The link state internal LinkDescriptor(object source, string sourceProperty, object target, EntityStates state) : base(state) { this.source = source; this.sourceProperty = sourceProperty; this.target = target; } #region Public Properties ///target entity public object Target { get { return this.target; } } ///source entity public object Source { get { return this.source; } } ///name of property on source entity that references the target entity public string SourceProperty { get { return this.sourceProperty; } } #endregion ///this is a link internal override bool IsResource { get { return false; } } ////// If the current instance of link descriptor is equivalent to the parameters supplied /// /// The source entity /// The source property name /// The target entity ///true if equivalent internal bool IsEquivalent(object src, string srcPropName, object targ) { return (this.source == src && this.target == targ && this.sourceProperty == srcPropName); } ///equivalence comparer private sealed class Equivalent : System.Collections.Generic.IEqualityComparer{ /// are two LinkDescriptors equivalent, ignore state /// link descriptor x /// link descriptor y ///true if equivalent public bool Equals(LinkDescriptor x, LinkDescriptor y) { return (null != x) && (null != y) && x.IsEquivalent(y.source, y.sourceProperty, y.target); } ///compute hashcode for LinkDescriptor /// link descriptor ///hashcode public int GetHashCode(LinkDescriptor obj) { return (null != obj) ? (obj.Source.GetHashCode() ^ ((null != obj.Target) ? obj.Target.GetHashCode() : 0) ^ obj.SourceProperty.GetHashCode()) : 0; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// represents the association between two entities // //--------------------------------------------------------------------- namespace System.Data.Services.Client { using System.Diagnostics; ////// represents the association between two entities /// [DebuggerDisplay("State = {state}")] public sealed class LinkDescriptor : Descriptor { #region Fields ///equivalence comparer internal static readonly System.Collections.Generic.IEqualityComparerEquivalenceComparer = new Equivalent(); /// source entity private object source; ///name of property on source entity that references the target entity private string sourceProperty; ///target entity private object target; #endregion ////// Constructor /// /// Source entity /// Navigation property on the source entity /// Target entity internal LinkDescriptor(object source, string sourceProperty, object target) : this(source, sourceProperty, target, EntityStates.Unchanged) { } ////// Constructor /// /// Source entity /// Navigation property on the source entity /// Target entity /// The link state internal LinkDescriptor(object source, string sourceProperty, object target, EntityStates state) : base(state) { this.source = source; this.sourceProperty = sourceProperty; this.target = target; } #region Public Properties ///target entity public object Target { get { return this.target; } } ///source entity public object Source { get { return this.source; } } ///name of property on source entity that references the target entity public string SourceProperty { get { return this.sourceProperty; } } #endregion ///this is a link internal override bool IsResource { get { return false; } } ////// If the current instance of link descriptor is equivalent to the parameters supplied /// /// The source entity /// The source property name /// The target entity ///true if equivalent internal bool IsEquivalent(object src, string srcPropName, object targ) { return (this.source == src && this.target == targ && this.sourceProperty == srcPropName); } ///equivalence comparer private sealed class Equivalent : System.Collections.Generic.IEqualityComparer{ /// are two LinkDescriptors equivalent, ignore state /// link descriptor x /// link descriptor y ///true if equivalent public bool Equals(LinkDescriptor x, LinkDescriptor y) { return (null != x) && (null != y) && x.IsEquivalent(y.source, y.sourceProperty, y.target); } ///compute hashcode for LinkDescriptor /// link descriptor ///hashcode public int GetHashCode(LinkDescriptor obj) { return (null != obj) ? (obj.Source.GetHashCode() ^ ((null != obj.Target) ? obj.Target.GetHashCode() : 0) ^ obj.SourceProperty.GetHashCode()) : 0; } } } } // 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
- WorkflowMarkupSerializationException.cs
- ChtmlPageAdapter.cs
- UpdatePanelControlTrigger.cs
- SafeFileMappingHandle.cs
- DataGridTextBoxColumn.cs
- TypeLoadException.cs
- NegotiateStream.cs
- ButtonBase.cs
- AnimationStorage.cs
- FixedPage.cs
- MDIWindowDialog.cs
- WebColorConverter.cs
- RuleEngine.cs
- EntityContainer.cs
- LockCookie.cs
- CaseStatement.cs
- CollectionDataContractAttribute.cs
- ToolBar.cs
- DetailsViewUpdateEventArgs.cs
- NativeMethods.cs
- Axis.cs
- ApplicationTrust.cs
- MetadataExchangeBindings.cs
- BufferBuilder.cs
- ExpanderAutomationPeer.cs
- QueueProcessor.cs
- TreeView.cs
- FileUtil.cs
- InvalidProgramException.cs
- CodeObjectCreateExpression.cs
- DataRelationPropertyDescriptor.cs
- SHA384Managed.cs
- WebPartUserCapability.cs
- IPAddressCollection.cs
- ColorKeyFrameCollection.cs
- PathStreamGeometryContext.cs
- RenderOptions.cs
- XamlStyleSerializer.cs
- CqlParserHelpers.cs
- NameValueFileSectionHandler.cs
- ToggleButtonAutomationPeer.cs
- peernodestatemanager.cs
- KnownBoxes.cs
- PageParser.cs
- ClientTargetSection.cs
- WindowsGraphicsCacheManager.cs
- SerializeAbsoluteContext.cs
- FilterableAttribute.cs
- ComponentDesigner.cs
- WMIInterop.cs
- WorkflowInstanceExtensionManager.cs
- ColorTypeConverter.cs
- HMACSHA384.cs
- FontStretchConverter.cs
- EmptyStringExpandableObjectConverter.cs
- WindowVisualStateTracker.cs
- DataColumnPropertyDescriptor.cs
- initElementDictionary.cs
- LogArchiveSnapshot.cs
- DesignTimeXamlWriter.cs
- WebResourceUtil.cs
- CreateUserWizardStep.cs
- Model3DCollection.cs
- ResourcePermissionBase.cs
- SettingsAttributes.cs
- TimelineClockCollection.cs
- DBSchemaTable.cs
- TypeDescriptionProviderAttribute.cs
- BinaryUtilClasses.cs
- XhtmlBasicSelectionListAdapter.cs
- DrawListViewSubItemEventArgs.cs
- SecureConversationDriver.cs
- StylusSystemGestureEventArgs.cs
- regiisutil.cs
- GridPatternIdentifiers.cs
- UnsafeCollabNativeMethods.cs
- InvalidProgramException.cs
- EncryptedKey.cs
- MatrixConverter.cs
- DataGridViewAutoSizeModeEventArgs.cs
- PartialTrustVisibleAssembly.cs
- BidOverLoads.cs
- Guid.cs
- XamlTemplateSerializer.cs
- WebBaseEventKeyComparer.cs
- Odbc32.cs
- GridViewRowPresenter.cs
- SmiEventSink_DeferedProcessing.cs
- SerializerWriterEventHandlers.cs
- MemberRestriction.cs
- FromReply.cs
- ComplexLine.cs
- GridToolTip.cs
- Lasso.cs
- HostProtectionPermission.cs
- DefaultTypeArgumentAttribute.cs
- HitTestFilterBehavior.cs
- TypeUtils.cs
- BamlTreeNode.cs
- DataGridItem.cs