Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / LinkDescriptor.cs / 4 / 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
- HttpsHostedTransportConfiguration.cs
- TextTabProperties.cs
- SoapAttributes.cs
- AssociationSetEnd.cs
- PermissionListSet.cs
- SimpleWebHandlerParser.cs
- StaticResourceExtension.cs
- PersonalizationState.cs
- EditorZone.cs
- SchemaType.cs
- HttpResponseMessageProperty.cs
- RC2.cs
- SqlBooleanMismatchVisitor.cs
- ConfigXmlComment.cs
- TreeView.cs
- NullableLongMinMaxAggregationOperator.cs
- HwndSourceKeyboardInputSite.cs
- Bezier.cs
- MaskedTextBoxTextEditor.cs
- Color.cs
- DefaultProfileManager.cs
- DataGridCell.cs
- AssemblyUtil.cs
- TypeGeneratedEventArgs.cs
- OrderedDictionaryStateHelper.cs
- StringComparer.cs
- ProcessThread.cs
- RoutingSection.cs
- SigningProgress.cs
- CompilerInfo.cs
- HierarchicalDataBoundControlAdapter.cs
- DynamicObject.cs
- ActiveXHost.cs
- FormViewPagerRow.cs
- GeometryCombineModeValidation.cs
- PrintPreviewGraphics.cs
- BufferedWebEventProvider.cs
- ResourceContainer.cs
- SettingsSection.cs
- LowerCaseStringConverter.cs
- SelectionPattern.cs
- DispatcherHookEventArgs.cs
- HealthMonitoringSectionHelper.cs
- ErrorRuntimeConfig.cs
- QilLoop.cs
- CollectionTraceRecord.cs
- RegexRunner.cs
- ValidationResult.cs
- DBNull.cs
- HtmlControlPersistable.cs
- TabRenderer.cs
- GcSettings.cs
- MetaForeignKeyColumn.cs
- TextModifierScope.cs
- QilScopedVisitor.cs
- SqlDataSourceFilteringEventArgs.cs
- LinearKeyFrames.cs
- PartialClassGenerationTaskInternal.cs
- SecUtil.cs
- RadioButtonList.cs
- PersistChildrenAttribute.cs
- XslAstAnalyzer.cs
- MgmtConfigurationRecord.cs
- FrameworkElementFactory.cs
- XPathNodeList.cs
- InvalidOperationException.cs
- CultureSpecificStringDictionary.cs
- ZipFileInfo.cs
- MethodExpr.cs
- XmlAttributeProperties.cs
- WebPartConnectionsConnectVerb.cs
- wmiprovider.cs
- TextControlDesigner.cs
- NavigateEvent.cs
- ToolStripManager.cs
- MasterPage.cs
- HtmlAnchor.cs
- XmlUtil.cs
- srgsitem.cs
- SettingsPropertyCollection.cs
- GetReadStreamResult.cs
- CatalogPart.cs
- Msec.cs
- EntityDesignerUtils.cs
- ByteAnimation.cs
- Hashtable.cs
- KoreanLunisolarCalendar.cs
- ValidatedControlConverter.cs
- NCryptSafeHandles.cs
- XPathNavigator.cs
- Collection.cs
- LinkedResource.cs
- IPHostEntry.cs
- Int16Animation.cs
- ParsedAttributeCollection.cs
- CodeMethodInvokeExpression.cs
- Context.cs
- InheritanceContextHelper.cs
- ThreadInterruptedException.cs
- EventManager.cs