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
- QueryOperationResponseOfT.cs
- ContractComponent.cs
- OperationDescription.cs
- EventPropertyMap.cs
- MonthChangedEventArgs.cs
- TableLayoutColumnStyleCollection.cs
- XmlObjectSerializerReadContextComplexJson.cs
- SelectingProviderEventArgs.cs
- SafeLocalAllocation.cs
- LongPath.cs
- SharedPerformanceCounter.cs
- WebPartRestoreVerb.cs
- TileBrush.cs
- ClientCultureInfo.cs
- ClonableStack.cs
- XmlEncodedRawTextWriter.cs
- CultureTableRecord.cs
- WebZone.cs
- Adorner.cs
- SwitchLevelAttribute.cs
- DataSourceBooleanViewSchemaConverter.cs
- SerializationSectionGroup.cs
- HandleRef.cs
- CacheSection.cs
- RuleSettingsCollection.cs
- CompilerGeneratedAttribute.cs
- SignatureDescription.cs
- ListViewDeletedEventArgs.cs
- BevelBitmapEffect.cs
- FixedTextPointer.cs
- ProfileSettings.cs
- HttpCachePolicyElement.cs
- BaseParaClient.cs
- Button.cs
- DataGridAutoFormat.cs
- XmlAtomicValue.cs
- RoutedEvent.cs
- TableRow.cs
- ImageField.cs
- DataListCommandEventArgs.cs
- BaseResourcesBuildProvider.cs
- OleDbParameterCollection.cs
- MethodCallTranslator.cs
- Highlights.cs
- SchemaImporter.cs
- BlockExpression.cs
- IIS7UserPrincipal.cs
- TreeBuilderBamlTranslator.cs
- DataGridViewSelectedCellCollection.cs
- IdentityReference.cs
- MailBnfHelper.cs
- SqlEnums.cs
- MetadataItemCollectionFactory.cs
- ChannelSinkStacks.cs
- ImplicitInputBrush.cs
- RelationHandler.cs
- XmlIncludeAttribute.cs
- ModelItemExtensions.cs
- DefaultTextStore.cs
- IIS7WorkerRequest.cs
- Point3DCollectionConverter.cs
- CommandBindingCollection.cs
- JsonEnumDataContract.cs
- wgx_exports.cs
- ServicePointManager.cs
- HuffCodec.cs
- ToolStripLocationCancelEventArgs.cs
- RandomNumberGenerator.cs
- NotifyIcon.cs
- RefType.cs
- WindowsAuthenticationModule.cs
- FormsAuthenticationUser.cs
- DropDownHolder.cs
- DiscoveryProxy.cs
- ProcessStartInfo.cs
- WebPartUtil.cs
- ObjectDataSourceMethodEventArgs.cs
- InputDevice.cs
- TextUtf8RawTextWriter.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- RegionData.cs
- EdmScalarPropertyAttribute.cs
- DataGridHeaderBorder.cs
- KeyTime.cs
- KeyEventArgs.cs
- TraceHwndHost.cs
- TraceHandlerErrorFormatter.cs
- DockingAttribute.cs
- ListViewDesigner.cs
- SimpleType.cs
- IntSecurity.cs
- IntegerFacetDescriptionElement.cs
- SemanticBasicElement.cs
- ObjectManager.cs
- TextAutomationPeer.cs
- SqlConnectionStringBuilder.cs
- EnumerableCollectionView.cs
- DataGridViewLinkCell.cs
- CommandLibraryHelper.cs
- FigureParaClient.cs