Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / LinkDescriptor.cs / 1 / 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 /// public sealed class LinkDescriptor : Descriptor { ///equivalence comparer internal static readonly System.Collections.Generic.IEqualityComparerEquivalentComparer = new Equivalent(); /// source entity private readonly object source; ///name of property on source entity that references the target entity private readonly string sourceProperty; ///target entity private readonly object target; ////// constructor /// /// source entity /// name of property on source entity that references the target entity /// target entity /// link state internal LinkDescriptor(object source, string sourceProperty, object target, EntityStates state) : base(state) { this.source = source; this.sourceProperty = sourceProperty; this.target = target; Debug.Assert(null != source, "null != source"); Debug.Assert(!string.IsNullOrEmpty(sourceProperty), "null != sourceProperty"); Debug.Assert(null != target || (EntityStates.Unchanged == state) || (EntityStates.Modified == state) || (EntityStates.Detached == state), "null != target"); Debug.Assert( EntityStates.Added == state || EntityStates.Modified == state || EntityStates.Deleted == state || EntityStates.Unchanged == state || EntityStates.Detached == state, "state"); } ///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; } } ///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 (x.Source == y.Source) && (x.Target == y.Target) && (x.SourceProperty == y.SourceProperty); } ///compute hashcode for LinkDescriptor /// link descriptor ///hashcode public int GetHashCode(LinkDescriptor obj) { return obj.Source.GetHashCode() ^ ((null != obj.Target) ? obj.Target.GetHashCode() : 0) ^ obj.SourceProperty.GetHashCode(); } } } } // 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 /// public sealed class LinkDescriptor : Descriptor { ///equivalence comparer internal static readonly System.Collections.Generic.IEqualityComparerEquivalentComparer = new Equivalent(); /// source entity private readonly object source; ///name of property on source entity that references the target entity private readonly string sourceProperty; ///target entity private readonly object target; ////// constructor /// /// source entity /// name of property on source entity that references the target entity /// target entity /// link state internal LinkDescriptor(object source, string sourceProperty, object target, EntityStates state) : base(state) { this.source = source; this.sourceProperty = sourceProperty; this.target = target; Debug.Assert(null != source, "null != source"); Debug.Assert(!string.IsNullOrEmpty(sourceProperty), "null != sourceProperty"); Debug.Assert(null != target || (EntityStates.Unchanged == state) || (EntityStates.Modified == state) || (EntityStates.Detached == state), "null != target"); Debug.Assert( EntityStates.Added == state || EntityStates.Modified == state || EntityStates.Deleted == state || EntityStates.Unchanged == state || EntityStates.Detached == state, "state"); } ///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; } } ///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 (x.Source == y.Source) && (x.Target == y.Target) && (x.SourceProperty == y.SourceProperty); } ///compute hashcode for LinkDescriptor /// link descriptor ///hashcode public int GetHashCode(LinkDescriptor obj) { return obj.Source.GetHashCode() ^ ((null != obj.Target) ? obj.Target.GetHashCode() : 0) ^ obj.SourceProperty.GetHashCode(); } } } } // 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
- EdmComplexPropertyAttribute.cs
- AsyncContentLoadedEventArgs.cs
- WindowsFormsLinkLabel.cs
- CellQuery.cs
- QueryConverter.cs
- Token.cs
- Events.cs
- ValueChangedEventManager.cs
- columnmapfactory.cs
- Vertex.cs
- WebControl.cs
- XdrBuilder.cs
- DetailsViewCommandEventArgs.cs
- NameService.cs
- LayoutEditorPart.cs
- CryptoApi.cs
- WrapPanel.cs
- XhtmlBasicObjectListAdapter.cs
- WebSysDescriptionAttribute.cs
- DataServiceRequestException.cs
- CodeConditionStatement.cs
- ContentElementAutomationPeer.cs
- FontStretches.cs
- LocalizableAttribute.cs
- ArcSegment.cs
- ToolStripItemEventArgs.cs
- UniqueIdentifierService.cs
- RuntimeHelpers.cs
- ThreadAttributes.cs
- input.cs
- PersonalizablePropertyEntry.cs
- ExpressionEvaluator.cs
- UrlAuthorizationModule.cs
- ThaiBuddhistCalendar.cs
- ReadOnlyCollectionBase.cs
- Encoder.cs
- EditorAttributeInfo.cs
- DataGridViewTextBoxCell.cs
- Policy.cs
- _CacheStreams.cs
- XmlElementAttribute.cs
- EventDescriptor.cs
- ObjectViewFactory.cs
- XmlCharCheckingReader.cs
- GeneralTransform2DTo3DTo2D.cs
- HttpRequestCacheValidator.cs
- Rotation3DAnimation.cs
- HwndKeyboardInputProvider.cs
- DesignTimeTemplateParser.cs
- CodePageUtils.cs
- Errors.cs
- UnicodeEncoding.cs
- DataSourceControl.cs
- PartialArray.cs
- PersonalizationProviderHelper.cs
- WindowsRegion.cs
- WindowsSpinner.cs
- DoubleLink.cs
- DomainUpDown.cs
- ActivityLocationReferenceEnvironment.cs
- Validator.cs
- ApplicationFileCodeDomTreeGenerator.cs
- EntityTypeEmitter.cs
- DataGridRow.cs
- SiteMap.cs
- ToolboxItemFilterAttribute.cs
- TrackingMemoryStream.cs
- ThreadAbortException.cs
- TabPage.cs
- Trace.cs
- ActivityCompletionCallbackWrapper.cs
- DataService.cs
- TypeLibConverter.cs
- ZeroOpNode.cs
- ConstraintManager.cs
- GridViewColumnHeaderAutomationPeer.cs
- IProvider.cs
- EventDrivenDesigner.cs
- SystemIPInterfaceStatistics.cs
- FrameworkObject.cs
- SQLChars.cs
- DesignerDataSourceView.cs
- CodeLinePragma.cs
- BasePropertyDescriptor.cs
- ModelChangedEventArgsImpl.cs
- XmlUnspecifiedAttribute.cs
- XamlFilter.cs
- TransformProviderWrapper.cs
- TypeDelegator.cs
- OpacityConverter.cs
- DBNull.cs
- TypeDependencyAttribute.cs
- Propagator.Evaluator.cs
- ExceptionHandler.cs
- SoapMessage.cs
- HotSpotCollection.cs
- CollectionView.cs
- SingleObjectCollection.cs
- ShimAsPublicXamlType.cs
- PostBackTrigger.cs