Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- DbConnectionPoolCounters.cs
- securestring.cs
- UTF32Encoding.cs
- BaseValidator.cs
- RichTextBox.cs
- FixedSOMTable.cs
- TabItemAutomationPeer.cs
- MimePart.cs
- documentsequencetextview.cs
- VoiceObjectToken.cs
- ClientSession.cs
- EncoderExceptionFallback.cs
- StandardCommands.cs
- HtmlTextArea.cs
- WebBrowserUriTypeConverter.cs
- Stack.cs
- webeventbuffer.cs
- ObjectManager.cs
- SqlException.cs
- FontUnit.cs
- MessageSmuggler.cs
- SchemaMerger.cs
- PagerSettings.cs
- ParameterBuilder.cs
- HandledMouseEvent.cs
- ConfigurationSectionCollection.cs
- Select.cs
- OutputCacheProfile.cs
- UntrustedRecipientException.cs
- HttpException.cs
- ReaderOutput.cs
- CodeIdentifiers.cs
- TraceEventCache.cs
- _TransmitFileOverlappedAsyncResult.cs
- SemaphoreFullException.cs
- CodeGen.cs
- TextAutomationPeer.cs
- ContentDesigner.cs
- UniqueIdentifierService.cs
- BitmapCacheBrush.cs
- ListViewPagedDataSource.cs
- ConfigXmlWhitespace.cs
- TableStyle.cs
- DayRenderEvent.cs
- TimerElapsedEvenArgs.cs
- BitmapEffectRenderDataResource.cs
- TextRangeEditLists.cs
- Model3DGroup.cs
- DeflateEmulationStream.cs
- CatalogPartCollection.cs
- FragmentQueryProcessor.cs
- XmlSchemaAttributeGroupRef.cs
- SymLanguageType.cs
- XPathSingletonIterator.cs
- BlobPersonalizationState.cs
- Decoder.cs
- BitVector32.cs
- ExpressionBuilderContext.cs
- WindowsAuthenticationEventArgs.cs
- MessagePartDescription.cs
- UnsafeNativeMethods.cs
- ApplicationActivator.cs
- SafeUserTokenHandle.cs
- AssertFilter.cs
- Geometry3D.cs
- BamlTreeMap.cs
- VisualTarget.cs
- XmlSchemaCollection.cs
- ReachSerializer.cs
- ChangeBlockUndoRecord.cs
- DataSysAttribute.cs
- CodeDomDecompiler.cs
- exports.cs
- StorageMappingItemLoader.cs
- FlowDocumentView.cs
- SystemNetworkInterface.cs
- TraceContextEventArgs.cs
- PolyQuadraticBezierSegment.cs
- InvalidOleVariantTypeException.cs
- Quad.cs
- ServiceCredentialsSecurityTokenManager.cs
- DocumentXmlWriter.cs
- Html32TextWriter.cs
- DesignerAttribute.cs
- ObjectListDataBindEventArgs.cs
- PathSegment.cs
- ConnectionPoolManager.cs
- DataGridViewUtilities.cs
- ServerValidateEventArgs.cs
- IconHelper.cs
- ResourceWriter.cs
- HierarchicalDataTemplate.cs
- InfoCardSymmetricCrypto.cs
- HtmlInputControl.cs
- PrintController.cs
- MailMessageEventArgs.cs
- CompiledQuery.cs
- WriteTimeStream.cs
- ToolBar.cs
- EndpointConfigContainer.cs