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
- GridViewColumn.cs
- RuleDefinitions.cs
- ModelEditingScope.cs
- BufferAllocator.cs
- AnimationLayer.cs
- CodeStatementCollection.cs
- ClientSponsor.cs
- CacheEntry.cs
- SqlBulkCopyColumnMapping.cs
- Trace.cs
- BufferedWebEventProvider.cs
- CapacityStreamGeometryContext.cs
- UnmanagedMemoryStreamWrapper.cs
- UpDownEvent.cs
- SQLInt32.cs
- ControlLocalizer.cs
- Types.cs
- Matrix.cs
- IntegerValidatorAttribute.cs
- TreeNode.cs
- FileSystemWatcher.cs
- ClientTargetSection.cs
- MethodRental.cs
- SolidBrush.cs
- XamlLoadErrorInfo.cs
- SafeHandles.cs
- KnownTypes.cs
- CodeMemberMethod.cs
- XPathAxisIterator.cs
- WCFServiceClientProxyGenerator.cs
- XmlSchemaSimpleType.cs
- safePerfProviderHandle.cs
- AdornerDecorator.cs
- SQLMembershipProvider.cs
- EqualityComparer.cs
- DataServiceEntityAttribute.cs
- AssociatedControlConverter.cs
- ConfigurationStrings.cs
- CommonRemoteMemoryBlock.cs
- ThreadSafeList.cs
- AdornerLayer.cs
- ResourceReferenceExpression.cs
- DCSafeHandle.cs
- DoubleAnimationUsingPath.cs
- StrokeNode.cs
- DataBindingCollection.cs
- ToolStripSeparator.cs
- StrokeCollection2.cs
- PanelContainerDesigner.cs
- GetLedgerRequest.cs
- updateconfighost.cs
- WindowsToolbar.cs
- Encoder.cs
- _PooledStream.cs
- Brush.cs
- DictionaryEntry.cs
- TableSectionStyle.cs
- RegexReplacement.cs
- WmlCalendarAdapter.cs
- PropertyGridCommands.cs
- coordinatorfactory.cs
- WebPartEditVerb.cs
- CompositeFontFamily.cs
- GenericPrincipal.cs
- CodeConditionStatement.cs
- TimeIntervalCollection.cs
- AttributeAction.cs
- QilCloneVisitor.cs
- ThicknessConverter.cs
- BuildManager.cs
- TypeExtensions.cs
- DocumentPageHost.cs
- XslException.cs
- TemplateBindingExpression.cs
- GeneralTransform2DTo3D.cs
- TextServicesCompartmentContext.cs
- Match.cs
- Page.cs
- ProgressBar.cs
- FixedStringLookup.cs
- EventNotify.cs
- DrawListViewSubItemEventArgs.cs
- FormsIdentity.cs
- ThreadPool.cs
- ToolStripDropDownClosingEventArgs.cs
- AnimationException.cs
- ExtensibleClassFactory.cs
- DataColumnMapping.cs
- InlineUIContainer.cs
- PrinterResolution.cs
- SynchronousChannelMergeEnumerator.cs
- DataGridCellsPanel.cs
- XmlResolver.cs
- SchemaMapping.cs
- Encoder.cs
- PostBackOptions.cs
- DerivedKeySecurityTokenStub.cs
- MembershipValidatePasswordEventArgs.cs
- DocumentSignatureManager.cs
- BackEase.cs