Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / Providers / ResourceAssociationType.cs / 1305376 / ResourceAssociationType.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Simple couple of classes to keep association descriptions // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Providers { using System.Diagnostics; using System.Collections.Generic; ////// Stores information about a association and its ends /// internal class ResourceAssociationType { ///FullName of the association. private readonly string fullName; ///Name of the association private readonly string name; ///end1 for this association. private readonly ResourceAssociationTypeEnd end1; ///end2 for this association. private readonly ResourceAssociationTypeEnd end2; ////// Creates a new instance of AssociationInfo to store information about an association. /// /// name of the association. /// namespaceName of the association. /// first end of the association. /// second end of the association. internal ResourceAssociationType(string name, string namespaceName, ResourceAssociationTypeEnd end1, ResourceAssociationTypeEnd end2) { Debug.Assert(!String.IsNullOrEmpty(name), "!String.IsNullOrEmpty(name)"); Debug.Assert(end1 != null && end2 != null, "end1 != null && end2 != null"); this.name = name; this.fullName = namespaceName + "." + name; this.end1 = end1; this.end2 = end2; } ///FullName of the association. internal string FullName { get { return this.fullName; } } ///Name of the association. internal string Name { get { return this.name; } } ///end1 for this association. internal ResourceAssociationTypeEnd End1 { get { return this.end1; } } ///end2 for this association. internal ResourceAssociationTypeEnd End2 { get { return this.end2; } } ////// Retrieve the end for the given resource set, type and property. /// /// resource type for the end /// resource property for the end ///Association type end for the given parameters internal ResourceAssociationTypeEnd GetResourceAssociationTypeEnd(ResourceType resourceType, ResourceProperty resourceProperty) { Debug.Assert(resourceType != null, "resourceType != null"); foreach (ResourceAssociationTypeEnd end in new[] { this.end1, this.end2 }) { if (end.ResourceType == resourceType && end.ResourceProperty == resourceProperty) { return end; } } return null; } ////// Retrieve the related end for the given resource set, type and property. /// /// resource type for the source end /// resource property for the source end ///Related association type end for the given parameters internal ResourceAssociationTypeEnd GetRelatedResourceAssociationSetEnd(ResourceType resourceType, ResourceProperty resourceProperty) { Debug.Assert(resourceType != null, "resourceType != null"); ResourceAssociationTypeEnd thisEnd = this.GetResourceAssociationTypeEnd(resourceType, resourceProperty); if (thisEnd != null) { foreach (ResourceAssociationTypeEnd end in new[] { this.end1, this.end2 }) { if (end != thisEnd) { return end; } } } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Simple couple of classes to keep association descriptions // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services.Providers { using System.Diagnostics; using System.Collections.Generic; ////// Stores information about a association and its ends /// internal class ResourceAssociationType { ///FullName of the association. private readonly string fullName; ///Name of the association private readonly string name; ///end1 for this association. private readonly ResourceAssociationTypeEnd end1; ///end2 for this association. private readonly ResourceAssociationTypeEnd end2; ////// Creates a new instance of AssociationInfo to store information about an association. /// /// name of the association. /// namespaceName of the association. /// first end of the association. /// second end of the association. internal ResourceAssociationType(string name, string namespaceName, ResourceAssociationTypeEnd end1, ResourceAssociationTypeEnd end2) { Debug.Assert(!String.IsNullOrEmpty(name), "!String.IsNullOrEmpty(name)"); Debug.Assert(end1 != null && end2 != null, "end1 != null && end2 != null"); this.name = name; this.fullName = namespaceName + "." + name; this.end1 = end1; this.end2 = end2; } ///FullName of the association. internal string FullName { get { return this.fullName; } } ///Name of the association. internal string Name { get { return this.name; } } ///end1 for this association. internal ResourceAssociationTypeEnd End1 { get { return this.end1; } } ///end2 for this association. internal ResourceAssociationTypeEnd End2 { get { return this.end2; } } ////// Retrieve the end for the given resource set, type and property. /// /// resource type for the end /// resource property for the end ///Association type end for the given parameters internal ResourceAssociationTypeEnd GetResourceAssociationTypeEnd(ResourceType resourceType, ResourceProperty resourceProperty) { Debug.Assert(resourceType != null, "resourceType != null"); foreach (ResourceAssociationTypeEnd end in new[] { this.end1, this.end2 }) { if (end.ResourceType == resourceType && end.ResourceProperty == resourceProperty) { return end; } } return null; } ////// Retrieve the related end for the given resource set, type and property. /// /// resource type for the source end /// resource property for the source end ///Related association type end for the given parameters internal ResourceAssociationTypeEnd GetRelatedResourceAssociationSetEnd(ResourceType resourceType, ResourceProperty resourceProperty) { Debug.Assert(resourceType != null, "resourceType != null"); ResourceAssociationTypeEnd thisEnd = this.GetResourceAssociationTypeEnd(resourceType, resourceProperty); if (thisEnd != null) { foreach (ResourceAssociationTypeEnd end in new[] { this.end1, this.end2 }) { if (end != thisEnd) { return end; } } } return null; } } } // 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
- WorkflowQueuingService.cs
- PolicyException.cs
- ResourceReferenceKeyNotFoundException.cs
- SortDescription.cs
- RuntimeConfig.cs
- DataGridRelationshipRow.cs
- FileUpload.cs
- Win32PrintDialog.cs
- ChangeToolStripParentVerb.cs
- PersistenceProviderBehavior.cs
- ByteKeyFrameCollection.cs
- XmlElementAttributes.cs
- XmlDocumentSurrogate.cs
- PolygonHotSpot.cs
- ClientSideProviderDescription.cs
- ActivityWithResultConverter.cs
- AppDomain.cs
- RemotingException.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SQLDecimalStorage.cs
- InfocardExtendedInformationCollection.cs
- InternalTypeHelper.cs
- Label.cs
- DataException.cs
- LinearGradientBrush.cs
- FilteredXmlReader.cs
- ListViewCommandEventArgs.cs
- SuppressMergeCheckAttribute.cs
- BufferModeSettings.cs
- Rights.cs
- ThreadPool.cs
- HitTestDrawingContextWalker.cs
- InputBinder.cs
- XPathQilFactory.cs
- MediaPlayer.cs
- Int32CAMarshaler.cs
- SimpleType.cs
- FeatureSupport.cs
- MDIClient.cs
- MenuAutomationPeer.cs
- PropertyState.cs
- DetailsViewPageEventArgs.cs
- SmtpFailedRecipientsException.cs
- GridErrorDlg.cs
- UIElement3DAutomationPeer.cs
- MetabaseSettingsIis7.cs
- SystemIPv4InterfaceProperties.cs
- ByteFacetDescriptionElement.cs
- ScrollContentPresenter.cs
- InputLanguage.cs
- TableColumnCollectionInternal.cs
- EmptyStringExpandableObjectConverter.cs
- StructuralType.cs
- IDReferencePropertyAttribute.cs
- PenCursorManager.cs
- ObjectStorage.cs
- WarningException.cs
- TextLineResult.cs
- DataContext.cs
- TextParagraph.cs
- HierarchicalDataBoundControlAdapter.cs
- SafeHandles.cs
- TypeHelper.cs
- wgx_commands.cs
- StrongBox.cs
- Image.cs
- ManagedWndProcTracker.cs
- RowToFieldTransformer.cs
- StringWriter.cs
- BindableAttribute.cs
- SafeNativeMethodsCLR.cs
- DataSourceIDConverter.cs
- SettingsProperty.cs
- MemoryStream.cs
- UserControl.cs
- BufferManager.cs
- TransformPattern.cs
- ChangeTracker.cs
- TextSelectionProcessor.cs
- XmlElement.cs
- StrongTypingException.cs
- ReliableChannelListener.cs
- ChannelPoolSettingsElement.cs
- CompositionTarget.cs
- XmlSchemaSimpleTypeRestriction.cs
- OleDragDropHandler.cs
- HandlerFactoryWrapper.cs
- XmlReflectionImporter.cs
- RSAOAEPKeyExchangeDeformatter.cs
- Codec.cs
- DashStyle.cs
- X509AsymmetricSecurityKey.cs
- TagPrefixAttribute.cs
- DiscardableAttribute.cs
- StringComparer.cs
- SqlExpander.cs
- dbenumerator.cs
- TokenBasedSet.cs
- FixedDocumentSequencePaginator.cs
- ParallelTimeline.cs