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
- ImportCatalogPart.cs
- Claim.cs
- XmlSchemaValidator.cs
- ItemCheckEvent.cs
- ConfigurationManager.cs
- ValueUtilsSmi.cs
- Animatable.cs
- RenderContext.cs
- StrokeDescriptor.cs
- RightsManagementEncryptionTransform.cs
- HtmlLink.cs
- FormViewCommandEventArgs.cs
- ChildTable.cs
- X509CertificateChain.cs
- TextLineResult.cs
- RadioButtonDesigner.cs
- TcpAppDomainProtocolHandler.cs
- SqlCacheDependencyDatabase.cs
- EditorZone.cs
- ObjectDataProvider.cs
- CounterSample.cs
- Expression.cs
- ExpressionBinding.cs
- WorkflowTransactionService.cs
- CompressEmulationStream.cs
- ConditionalAttribute.cs
- IPGlobalProperties.cs
- OrderedDictionaryStateHelper.cs
- QilTargetType.cs
- DataServiceRequestOfT.cs
- GrabHandleGlyph.cs
- StrokeIntersection.cs
- AndCondition.cs
- OrderablePartitioner.cs
- VisualStyleRenderer.cs
- LocalizableAttribute.cs
- SelectionItemPattern.cs
- FormatConvertedBitmap.cs
- SqlExpander.cs
- Aggregates.cs
- DiscoveryRequestHandler.cs
- OdbcPermission.cs
- dbdatarecord.cs
- FilteredAttributeCollection.cs
- CustomErrorCollection.cs
- ScrollChrome.cs
- DataGridRelationshipRow.cs
- PageCodeDomTreeGenerator.cs
- StandardBindingCollectionElement.cs
- OpCellTreeNode.cs
- DataGridViewRowPostPaintEventArgs.cs
- DecoderBestFitFallback.cs
- CategoryAttribute.cs
- DataContractSerializerFaultFormatter.cs
- DetailsViewInsertEventArgs.cs
- Console.cs
- WmpBitmapEncoder.cs
- TypeContext.cs
- ReflectEventDescriptor.cs
- Module.cs
- Peer.cs
- TextBoxAutoCompleteSourceConverter.cs
- TemplateKey.cs
- DataGridClipboardCellContent.cs
- ChtmlTextBoxAdapter.cs
- RequestQueryParser.cs
- Expression.cs
- ITreeGenerator.cs
- SerializationFieldInfo.cs
- ClientScriptItem.cs
- GenericUriParser.cs
- VerificationException.cs
- FontWeights.cs
- ValueUtilsSmi.cs
- DataGridViewHitTestInfo.cs
- _HTTPDateParse.cs
- KeyedHashAlgorithm.cs
- AxisAngleRotation3D.cs
- SocketStream.cs
- LinearGradientBrush.cs
- DbParameterCollection.cs
- XmlIlVisitor.cs
- ListViewGroupItemCollection.cs
- Stroke2.cs
- SiteIdentityPermission.cs
- TypeLoader.cs
- Vector.cs
- SolidColorBrush.cs
- Point.cs
- PersonalizationProvider.cs
- _ListenerRequestStream.cs
- PackageRelationship.cs
- SecurityTokenProvider.cs
- DataGridView.cs
- PrintDocument.cs
- ObfuscationAttribute.cs
- FileUpload.cs
- SqlConnectionFactory.cs
- ToolStripItemEventArgs.cs
- DoWorkEventArgs.cs