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
- ExeContext.cs
- ToolStripItemEventArgs.cs
- Operand.cs
- TextLineResult.cs
- DesignerToolboxInfo.cs
- ParserExtension.cs
- GroupItem.cs
- AsmxEndpointPickerExtension.cs
- AppearanceEditorPart.cs
- TextLineBreak.cs
- SurrogateSelector.cs
- ExceptionUtility.cs
- StrongNameMembershipCondition.cs
- HMACSHA256.cs
- EncodingTable.cs
- DynamicUpdateCommand.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- VScrollBar.cs
- ImageAttributes.cs
- SrgsOneOf.cs
- BamlLocalizableResource.cs
- validation.cs
- Image.cs
- WindowsGraphics2.cs
- MapPathBasedVirtualPathProvider.cs
- ZipPackagePart.cs
- XPathParser.cs
- loginstatus.cs
- WeakReferenceKey.cs
- ApplicationCommands.cs
- SymbolMethod.cs
- SchemaImporter.cs
- TransformerInfo.cs
- grammarelement.cs
- ConstrainedDataObject.cs
- CompilerInfo.cs
- TreeSet.cs
- HttpResponseHeader.cs
- HostedBindingBehavior.cs
- WindowShowOrOpenTracker.cs
- StringWriter.cs
- DllNotFoundException.cs
- FixedSOMImage.cs
- RootProfilePropertySettingsCollection.cs
- PiiTraceSource.cs
- MeshGeometry3D.cs
- DataGridAutomationPeer.cs
- RectKeyFrameCollection.cs
- DbConnectionInternal.cs
- XD.cs
- BamlReader.cs
- ThreadStartException.cs
- XmlILOptimizerVisitor.cs
- unsafenativemethodsother.cs
- Sql8ConformanceChecker.cs
- ApplicationCommands.cs
- TreeWalker.cs
- ZipFileInfo.cs
- WebPartMovingEventArgs.cs
- PropertyInformationCollection.cs
- SemanticKeyElement.cs
- BamlRecordReader.cs
- ObjectDataProvider.cs
- ConnectionStringsSection.cs
- DataGrid.cs
- OleDbRowUpdatedEvent.cs
- DesignerEventService.cs
- ManifestSignatureInformation.cs
- SecurityContext.cs
- HttpContext.cs
- SystemColorTracker.cs
- SHA1.cs
- RecoverInstanceLocksCommand.cs
- PeerEndPoint.cs
- TableTextElementCollectionInternal.cs
- XPathExpr.cs
- WebCategoryAttribute.cs
- WebProxyScriptElement.cs
- FloaterBaseParagraph.cs
- CheckBoxRenderer.cs
- EditCommandColumn.cs
- DecoderFallback.cs
- PointIndependentAnimationStorage.cs
- WebPermission.cs
- TrackBarRenderer.cs
- ChildTable.cs
- PipelineComponent.cs
- FactoryRecord.cs
- BindingList.cs
- SatelliteContractVersionAttribute.cs
- ReadOnlyDataSourceView.cs
- unsafenativemethodsother.cs
- WmlCalendarAdapter.cs
- CheckBoxFlatAdapter.cs
- DataGridViewButtonCell.cs
- DispatcherProcessingDisabled.cs
- Guid.cs
- Rect3D.cs
- IndexedGlyphRun.cs
- TraceContextRecord.cs