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
- StateDesigner.Layouts.cs
- FixedHyperLink.cs
- FrameAutomationPeer.cs
- EntityDesignerBuildProvider.cs
- ExpressionPrefixAttribute.cs
- MetadataUtil.cs
- StatusBarPanel.cs
- RuleInfoComparer.cs
- cookiecollection.cs
- ToolStripItemImageRenderEventArgs.cs
- HttpStreamMessage.cs
- AvTrace.cs
- WebPartDescription.cs
- ContainerUtilities.cs
- OdbcPermission.cs
- Rect3DValueSerializer.cs
- DetailsViewCommandEventArgs.cs
- MessagePropertyVariants.cs
- XPathSingletonIterator.cs
- GeometryGroup.cs
- GregorianCalendar.cs
- VerticalAlignConverter.cs
- ItemsControl.cs
- DocumentGridContextMenu.cs
- ObjectContext.cs
- Baml2006KnownTypes.cs
- WebUtility.cs
- EastAsianLunisolarCalendar.cs
- OrderPreservingPipeliningMergeHelper.cs
- DesignerForm.cs
- XmlChildEnumerator.cs
- WindowsEditBox.cs
- ResourceDictionaryCollection.cs
- Atom10ItemFormatter.cs
- KerberosSecurityTokenProvider.cs
- CacheVirtualItemsEvent.cs
- Instrumentation.cs
- XmlArrayItemAttribute.cs
- BitmapImage.cs
- BuildManager.cs
- ClientRolePrincipal.cs
- RegexCapture.cs
- ItemDragEvent.cs
- remotingproxy.cs
- InputBuffer.cs
- XPathPatternParser.cs
- RequestCachePolicy.cs
- QueueAccessMode.cs
- GorillaCodec.cs
- DataSvcMapFileSerializer.cs
- MemoryResponseElement.cs
- OperationFormatter.cs
- BridgeDataReader.cs
- Expressions.cs
- CachedPathData.cs
- LogReservationCollection.cs
- HexParser.cs
- CodeGotoStatement.cs
- filewebrequest.cs
- ParentUndoUnit.cs
- DispatcherHooks.cs
- RequestUriProcessor.cs
- PkcsUtils.cs
- SoapReflectionImporter.cs
- PersonalizationProviderHelper.cs
- XPathSelectionIterator.cs
- PerformanceCounterManager.cs
- CatalogPart.cs
- ConvertersCollection.cs
- BamlTreeUpdater.cs
- OleDbDataAdapter.cs
- DataObjectSettingDataEventArgs.cs
- VariableReference.cs
- ParseHttpDate.cs
- HtmlControlPersistable.cs
- BuildProvidersCompiler.cs
- PeerApplication.cs
- FacetChecker.cs
- ManifestResourceInfo.cs
- CornerRadius.cs
- Operators.cs
- RoleManagerEventArgs.cs
- SystemPens.cs
- AssemblyAttributes.cs
- AuthorizationRule.cs
- ExpressionEditorSheet.cs
- ColumnMapTranslator.cs
- StorageEntityContainerMapping.cs
- DashStyle.cs
- DesignerActionVerbList.cs
- ConfigurationPropertyCollection.cs
- ControlEvent.cs
- InstancePersistenceCommandException.cs
- _NativeSSPI.cs
- CFStream.cs
- MediaContextNotificationWindow.cs
- Decorator.cs
- Subtree.cs
- CalendarDay.cs
- FormsAuthenticationUserCollection.cs