Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Metadata / Edm / safelink.cs / 1 / safelink.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //---------------------------------------------------------------------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 [....], [....] //---------------------------------------------------------------------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
- TemplateGroupCollection.cs
- PageAdapter.cs
- MultitargetUtil.cs
- HotSpot.cs
- SourceFileInfo.cs
- Graph.cs
- webbrowsersite.cs
- RIPEMD160Managed.cs
- Internal.cs
- FormViewInsertEventArgs.cs
- HandleCollector.cs
- NativeMethods.cs
- CharacterHit.cs
- TypeValidationEventArgs.cs
- DataBoundControlDesigner.cs
- PageBuildProvider.cs
- SharedStream.cs
- SID.cs
- Empty.cs
- Label.cs
- SyndicationItemFormatter.cs
- IndexerNameAttribute.cs
- ComplexPropertyEntry.cs
- StrongNameKeyPair.cs
- LabelExpression.cs
- DetailsView.cs
- CommandDesigner.cs
- DateTimeOffsetStorage.cs
- StdRegProviderWrapper.cs
- RowsCopiedEventArgs.cs
- DbProviderFactoriesConfigurationHandler.cs
- ADConnectionHelper.cs
- ToolTip.cs
- GlyphManager.cs
- RuntimeArgumentHandle.cs
- dsa.cs
- PolicyException.cs
- CacheDependency.cs
- DataGridRow.cs
- BlobPersonalizationState.cs
- TreeNodeBinding.cs
- TextStore.cs
- HandlerMappingMemo.cs
- ConvertEvent.cs
- ZipIOExtraFieldZip64Element.cs
- SHA1Managed.cs
- OdbcEnvironment.cs
- ScrollData.cs
- FileSystemInfo.cs
- ContextProperty.cs
- StrokeCollection2.cs
- PopupControlService.cs
- ScriptIgnoreAttribute.cs
- CodeAttachEventStatement.cs
- EventProxy.cs
- ManagedFilter.cs
- SyndicationContent.cs
- InputBinding.cs
- Point3DCollection.cs
- XmlDataDocument.cs
- DispatcherSynchronizationContext.cs
- TableDetailsRow.cs
- XmlSchemaObjectCollection.cs
- ShapingEngine.cs
- TemplateField.cs
- SafeHandles.cs
- Condition.cs
- CleanUpVirtualizedItemEventArgs.cs
- TextServicesHost.cs
- DataGridViewCellValueEventArgs.cs
- MimePart.cs
- ScriptIgnoreAttribute.cs
- ImageIndexConverter.cs
- CompositionAdorner.cs
- AppDomainAttributes.cs
- Duration.cs
- Thickness.cs
- BuildResult.cs
- ObjectListCommand.cs
- RealProxy.cs
- SystemResourceHost.cs
- TextTreePropertyUndoUnit.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- ManagedIStream.cs
- Matrix3DStack.cs
- DialogWindow.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- ComponentManagerBroker.cs
- coordinatorfactory.cs
- AppLevelCompilationSectionCache.cs
- ProxyAttribute.cs
- MsmqProcessProtocolHandler.cs
- PrintSystemException.cs
- OdbcReferenceCollection.cs
- XmlReflectionMember.cs
- contentDescriptor.cs
- HtmlTable.cs
- Util.cs
- MaskedTextBox.cs
- JumpPath.cs