Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / safelink.cs / 1305376 / safelink.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //---------------------------------------------------------------------using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace System.Data.Metadata.Edm { internal class SafeLinkwhere TParent : class { private TParent _value; public TParent Value { get { return _value; } } internal static IEnumerable BindChildren (TParent parent, Func > getLink, IEnumerable children) { foreach (TChild child in children) { BindChild(parent, getLink, child); } return children; } internal static TChild BindChild (TParent parent, Func > getLink, TChild child) { SafeLink link = getLink(child); Debug.Assert(link._value == null || link._value == parent, "don't try to hook up the same child to a different parent"); // this is the good stuff.. // only this method can actually make the link since _value is a private link._value = parent; return child; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //---------------------------------------------------------------------using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace System.Data.Metadata.Edm { internal class SafeLinkwhere TParent : class { private TParent _value; public TParent Value { get { return _value; } } internal static IEnumerable BindChildren (TParent parent, Func > getLink, IEnumerable children) { foreach (TChild child in children) { BindChild(parent, getLink, child); } return children; } internal static TChild BindChild (TParent parent, Func > getLink, TChild child) { SafeLink link = getLink(child); Debug.Assert(link._value == null || link._value == parent, "don't try to hook up the same child to a different parent"); // this is the good stuff.. // only this method can actually make the link since _value is a private link._value = parent; return child; } } } // 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
- UserControlBuildProvider.cs
- IOException.cs
- DataReceivedEventArgs.cs
- WebServiceEnumData.cs
- WorkflowTransactionOptions.cs
- OdbcConnectionString.cs
- XmlTextEncoder.cs
- InvokePattern.cs
- SequenceDesigner.cs
- SmiConnection.cs
- TrustManager.cs
- PolygonHotSpot.cs
- ListBoxItem.cs
- ClientFormsIdentity.cs
- SQLMembershipProvider.cs
- ParallelTimeline.cs
- SqlExpressionNullability.cs
- SqlDataSourceConfigureFilterForm.cs
- AuthenticationModuleElement.cs
- CompModSwitches.cs
- RankException.cs
- CancelAsyncOperationRequest.cs
- UIElementParagraph.cs
- HTTPNotFoundHandler.cs
- ResourceDefaultValueAttribute.cs
- VariableQuery.cs
- login.cs
- NavigatingCancelEventArgs.cs
- SoapIgnoreAttribute.cs
- versioninfo.cs
- HttpCachePolicyElement.cs
- PersonalizationProvider.cs
- AssemblyAttributesGoHere.cs
- JumpTask.cs
- Popup.cs
- XmlDataProvider.cs
- System.Data_BID.cs
- ServerValidateEventArgs.cs
- TextMessageEncodingBindingElement.cs
- ITreeGenerator.cs
- ListQueryResults.cs
- ActiveDocumentEvent.cs
- KerberosReceiverSecurityToken.cs
- RubberbandSelector.cs
- XmlKeywords.cs
- GridViewDeleteEventArgs.cs
- DataObjectAttribute.cs
- SortableBindingList.cs
- AnnotationResourceCollection.cs
- PointAnimation.cs
- Literal.cs
- _LocalDataStore.cs
- MulticastOption.cs
- StylusButtonCollection.cs
- HashAlgorithm.cs
- DocumentOrderQuery.cs
- X509Certificate.cs
- ClientTargetSection.cs
- SatelliteContractVersionAttribute.cs
- AppSecurityManager.cs
- BasicDesignerLoader.cs
- TransformGroup.cs
- FixedSOMImage.cs
- AsyncCompletedEventArgs.cs
- SimplePropertyEntry.cs
- formatter.cs
- RegexCaptureCollection.cs
- MatrixTransform.cs
- ListSortDescription.cs
- AsmxEndpointPickerExtension.cs
- Brushes.cs
- TextFormatterContext.cs
- CodeVariableDeclarationStatement.cs
- LambdaCompiler.Expressions.cs
- DefaultValueMapping.cs
- TableLayoutPanelCellPosition.cs
- BaseAutoFormat.cs
- TextTabProperties.cs
- XmlSchemaComplexContent.cs
- ArraySet.cs
- OSFeature.cs
- ScaleTransform3D.cs
- TableProviderWrapper.cs
- ServicePointManagerElement.cs
- TriggerCollection.cs
- XmlQualifiedNameTest.cs
- XamlRtfConverter.cs
- EqualityArray.cs
- Span.cs
- TrackingProfile.cs
- EditorZone.cs
- VectorAnimationBase.cs
- ResourcesBuildProvider.cs
- ResourceContainerWrapper.cs
- ExpressionLexer.cs
- XmlMemberMapping.cs
- AppSettingsSection.cs
- ChildTable.cs
- Registry.cs
- ISAPIApplicationHost.cs