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
- Regex.cs
- CompositeActivityTypeDescriptorProvider.cs
- ListControlBuilder.cs
- RoleManagerEventArgs.cs
- ProtectedProviderSettings.cs
- XmlSchemaSimpleTypeList.cs
- MultiPropertyDescriptorGridEntry.cs
- Container.cs
- ResourceDescriptionAttribute.cs
- MetadataPropertyvalue.cs
- KernelTypeValidation.cs
- UnmanagedHandle.cs
- ToolStripPanelCell.cs
- RouteValueDictionary.cs
- XmlLinkedNode.cs
- ReferentialConstraint.cs
- WebPartMenu.cs
- ValidationPropertyAttribute.cs
- LongValidatorAttribute.cs
- HtmlTableCell.cs
- XmlAttributeOverrides.cs
- Restrictions.cs
- LogFlushAsyncResult.cs
- ComboBoxDesigner.cs
- SqlTransaction.cs
- HttpWebResponse.cs
- WorkflowDefinitionContext.cs
- DBSchemaTable.cs
- Iis7Helper.cs
- AssemblyCollection.cs
- AutomationProperty.cs
- AuthenticateEventArgs.cs
- MappingSource.cs
- MemberRelationshipService.cs
- ObjectQueryState.cs
- ExpressionBuilder.cs
- ReflectTypeDescriptionProvider.cs
- RepeatButton.cs
- DataViewManager.cs
- DrawingDrawingContext.cs
- Vector3DAnimation.cs
- RMPublishingDialog.cs
- CategoryAttribute.cs
- ControlBuilder.cs
- LoginName.cs
- Polyline.cs
- UIElementPropertyUndoUnit.cs
- SurrogateSelector.cs
- GridPattern.cs
- Vector.cs
- RectangleF.cs
- CancelEventArgs.cs
- RawStylusSystemGestureInputReport.cs
- Missing.cs
- PeerApplication.cs
- BitmapVisualManager.cs
- DataContractSerializer.cs
- ResourceReader.cs
- XamlReader.cs
- DataSourceView.cs
- WorkflowEnvironment.cs
- AutoResetEvent.cs
- HasCopySemanticsAttribute.cs
- SqlEnums.cs
- UncommonField.cs
- BooleanConverter.cs
- EventRoute.cs
- ImageSourceConverter.cs
- SafeLibraryHandle.cs
- Pair.cs
- ThemeDictionaryExtension.cs
- Funcletizer.cs
- RetriableClipboard.cs
- WorkflowMessageEventHandler.cs
- TcpClientChannel.cs
- Propagator.Evaluator.cs
- SqlCacheDependencyDatabase.cs
- ColorConvertedBitmap.cs
- Scheduling.cs
- EpmContentSerializer.cs
- KeyboardDevice.cs
- Geometry.cs
- unsafenativemethodsother.cs
- AccessText.cs
- ScrollChrome.cs
- TextSegment.cs
- GeometryCombineModeValidation.cs
- CodeExpressionRuleDeclaration.cs
- TreeNodeMouseHoverEvent.cs
- FileUpload.cs
- WinFormsSecurity.cs
- MetaModel.cs
- DataGridCommandEventArgs.cs
- _IPv6Address.cs
- Soap12FormatExtensions.cs
- DebugControllerThread.cs
- StringResourceManager.cs
- _NativeSSPI.cs
- ListViewUpdatedEventArgs.cs
- AudioLevelUpdatedEventArgs.cs