Code:
/ 4.0 / 4.0 / untmp / 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 SafeLink where 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
- XmlHelper.cs
- Range.cs
- Validator.cs
- XmlEventCache.cs
- XmlConverter.cs
- WebBrowserProgressChangedEventHandler.cs
- ErrorInfoXmlDocument.cs
- DesignerSerializationOptionsAttribute.cs
- LinqDataSourceDisposeEventArgs.cs
- CommonProperties.cs
- DbgUtil.cs
- HtmlCalendarAdapter.cs
- PtsContext.cs
- ButtonRenderer.cs
- WSFederationHttpSecurityMode.cs
- ToolStripMenuItemCodeDomSerializer.cs
- TextDecorationCollection.cs
- SkipQueryOptionExpression.cs
- NameValuePermission.cs
- CharacterMetrics.cs
- PageCodeDomTreeGenerator.cs
- BinaryMessageEncoder.cs
- ScriptReferenceBase.cs
- MenuItem.cs
- httpapplicationstate.cs
- SafeSystemMetrics.cs
- OrderedDictionary.cs
- Compilation.cs
- Button.cs
- ResourceManagerWrapper.cs
- DocumentPageViewAutomationPeer.cs
- DbRetry.cs
- OutputCacheProfileCollection.cs
- HttpInputStream.cs
- PipelineComponent.cs
- JumpTask.cs
- XhtmlTextWriter.cs
- DTCTransactionManager.cs
- PersonalizationEntry.cs
- RegexTree.cs
- WindowsListViewItemStartMenu.cs
- Baml6ConstructorInfo.cs
- IISUnsafeMethods.cs
- ResourceDisplayNameAttribute.cs
- EventProviderWriter.cs
- EventsTab.cs
- ContractsBCL.cs
- CancelRequestedQuery.cs
- ConfigXmlWhitespace.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ListViewItem.cs
- DesignerActionService.cs
- CollectionsUtil.cs
- Utility.cs
- XmlDataDocument.cs
- X509CertificateRecipientClientCredential.cs
- mactripleDES.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- ControlCachePolicy.cs
- TextRunTypographyProperties.cs
- TransformedBitmap.cs
- GetReadStreamResult.cs
- AsyncPostBackTrigger.cs
- _SpnDictionary.cs
- ProviderCommandInfoUtils.cs
- ResolvedKeyFrameEntry.cs
- ConfigXmlCDataSection.cs
- BmpBitmapEncoder.cs
- PerformanceCounterManager.cs
- arabicshape.cs
- GroupJoinQueryOperator.cs
- DataGridViewColumnCollectionEditor.cs
- HitTestParameters3D.cs
- DragCompletedEventArgs.cs
- TraceContextEventArgs.cs
- Point3DConverter.cs
- ListenerHandler.cs
- Path.cs
- ToolStripPanelRenderEventArgs.cs
- GlyphRunDrawing.cs
- PreservationFileWriter.cs
- DllNotFoundException.cs
- BatchServiceHost.cs
- CuspData.cs
- AssertUtility.cs
- ListInitExpression.cs
- DependencyObjectType.cs
- FixedTextBuilder.cs
- ItemTypeToolStripMenuItem.cs
- InstanceKeyNotReadyException.cs
- SchemaDeclBase.cs
- BuildDependencySet.cs
- ManagementNamedValueCollection.cs
- PageFunction.cs
- UnmanagedMemoryAccessor.cs
- PropertyEmitter.cs
- CompiledXpathExpr.cs
- MarshalByRefObject.cs
- Color.cs
- NameValuePermission.cs