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
- XmlSchemaAttributeGroupRef.cs
- NumericPagerField.cs
- ILGenerator.cs
- GridToolTip.cs
- HttpClientCertificate.cs
- GridViewPageEventArgs.cs
- Rect3DConverter.cs
- ValidatingCollection.cs
- BitmapEffect.cs
- TypedElement.cs
- CaretElement.cs
- MultiView.cs
- FormatConvertedBitmap.cs
- HtmlEmptyTagControlBuilder.cs
- _LazyAsyncResult.cs
- SurrogateSelector.cs
- LingerOption.cs
- ValidationUtility.cs
- SQLGuid.cs
- ValidationPropertyAttribute.cs
- RefExpr.cs
- EnumValAlphaComparer.cs
- SoapSchemaImporter.cs
- FamilyTypeface.cs
- EditorPartDesigner.cs
- BroadcastEventHelper.cs
- PrintDocument.cs
- SchemaImporter.cs
- FormParameter.cs
- ClipboardData.cs
- Gdiplus.cs
- ValidationEventArgs.cs
- DebuggerAttributes.cs
- DataGridViewTextBoxCell.cs
- AutomationPatternInfo.cs
- Brush.cs
- MessageQueuePermission.cs
- SpellCheck.cs
- DuplexSecurityProtocolFactory.cs
- And.cs
- Header.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- PageBuildProvider.cs
- SurrogateEncoder.cs
- TypeReference.cs
- HtmlTableCellCollection.cs
- Avt.cs
- SystemResourceKey.cs
- BitHelper.cs
- DataGridLinkButton.cs
- ADMembershipUser.cs
- XXXInfos.cs
- DeclarativeCatalogPart.cs
- WebServiceData.cs
- UnsafeMethods.cs
- SkewTransform.cs
- ImmutableObjectAttribute.cs
- StandardCommands.cs
- PopupEventArgs.cs
- XmlnsDictionary.cs
- NativeMethods.cs
- StylusPoint.cs
- ModelPropertyCollectionImpl.cs
- XmlAttributeCollection.cs
- FormClosingEvent.cs
- SignerInfo.cs
- DragCompletedEventArgs.cs
- WindowsFormsLinkLabel.cs
- commandenforcer.cs
- MarshalByValueComponent.cs
- RectangleF.cs
- XmlSchemaSequence.cs
- OperatorExpressions.cs
- PrivateFontCollection.cs
- EntityClassGenerator.cs
- CertificateManager.cs
- BevelBitmapEffect.cs
- PackageProperties.cs
- Vector.cs
- ScrollBarRenderer.cs
- ObjectComplexPropertyMapping.cs
- UdpTransportSettingsElement.cs
- GridPattern.cs
- CalendarDateRange.cs
- TrackingLocation.cs
- SQLByteStorage.cs
- PropertyEmitter.cs
- SecurityDocument.cs
- GeneralTransform3DGroup.cs
- MatrixIndependentAnimationStorage.cs
- TextBoxAutomationPeer.cs
- OciLobLocator.cs
- UserInitiatedNavigationPermission.cs
- Timeline.cs
- XmlILCommand.cs
- Size3DValueSerializer.cs
- InlineObject.cs
- CriticalExceptions.cs
- CheckBox.cs
- RNGCryptoServiceProvider.cs