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
- FunctionOverloadResolver.cs
- FirstMatchCodeGroup.cs
- MarginsConverter.cs
- RouteItem.cs
- WindowsEditBox.cs
- PolicyAssertionCollection.cs
- MatrixCamera.cs
- WindowsGraphicsCacheManager.cs
- CustomValidator.cs
- SchemaImporterExtensionsSection.cs
- InstanceNotFoundException.cs
- DataServiceRequestOfT.cs
- NullableFloatMinMaxAggregationOperator.cs
- SmiEventSink.cs
- WinInet.cs
- RedirectionProxy.cs
- ObjectParameter.cs
- DataGridAutoFormat.cs
- XmlSchemaAnnotated.cs
- HttpStreamMessageEncoderFactory.cs
- ReferentialConstraint.cs
- PersonalizablePropertyEntry.cs
- FuncTypeConverter.cs
- propertytag.cs
- Bold.cs
- TraceHandler.cs
- DataGridLinkButton.cs
- HtmlElementEventArgs.cs
- DynamicRendererThreadManager.cs
- AdvancedBindingEditor.cs
- ErrorRuntimeConfig.cs
- ContractMapping.cs
- ClientTargetCollection.cs
- TriggerBase.cs
- WindowsContainer.cs
- ErrorItem.cs
- XmlDictionaryWriter.cs
- BasicCommandTreeVisitor.cs
- Matrix3DConverter.cs
- Subtree.cs
- TableLayoutCellPaintEventArgs.cs
- SchemaMerger.cs
- UrlMappingsSection.cs
- ConfigurationSectionHelper.cs
- EncoderFallback.cs
- DocumentReference.cs
- Boolean.cs
- Array.cs
- ParamArrayAttribute.cs
- OLEDB_Enum.cs
- SubMenuStyleCollection.cs
- CompositeScriptReference.cs
- BindToObject.cs
- MDIWindowDialog.cs
- EncryptedReference.cs
- BreadCrumbTextConverter.cs
- UInt64.cs
- Avt.cs
- BitmapEffectInputConnector.cs
- FindCompletedEventArgs.cs
- BindUriHelper.cs
- CaseInsensitiveComparer.cs
- ApplicationActivator.cs
- RadioButtonList.cs
- TlsnegoTokenAuthenticator.cs
- DllNotFoundException.cs
- AutomationPattern.cs
- Encoder.cs
- RegionData.cs
- GetWinFXPath.cs
- BitmapVisualManager.cs
- FileLogRecordHeader.cs
- DynamicUpdateCommand.cs
- ImageDrawing.cs
- GeometryGroup.cs
- ContentType.cs
- BitSet.cs
- SerializerDescriptor.cs
- Number.cs
- WebSysDisplayNameAttribute.cs
- RuleRef.cs
- CompositeControl.cs
- SmuggledIUnknown.cs
- TaskCanceledException.cs
- ContainerParagraph.cs
- ToolStripDropTargetManager.cs
- GZipDecoder.cs
- DrawingAttributeSerializer.cs
- SemanticResultKey.cs
- GeneralTransform3DTo2DTo3D.cs
- StickyNoteHelper.cs
- DashStyle.cs
- HttpServerVarsCollection.cs
- HttpStaticObjectsCollectionWrapper.cs
- InstanceDataCollection.cs
- TextOptionsInternal.cs
- ChangePassword.cs
- LinkButton.cs
- ValidatorUtils.cs
- StructuredTypeInfo.cs