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
- ServiceContractGenerationContext.cs
- RangeValuePattern.cs
- SecondaryViewProvider.cs
- OutputCacheSettings.cs
- Renderer.cs
- NetCodeGroup.cs
- SqlStatistics.cs
- ButtonChrome.cs
- SystemParameters.cs
- InputManager.cs
- DesignTimeXamlWriter.cs
- XmlSchemaAll.cs
- PresentationAppDomainManager.cs
- DataChangedEventManager.cs
- MethodRental.cs
- DesignerValidatorAdapter.cs
- SearchForVirtualItemEventArgs.cs
- SessionStateSection.cs
- MenuItemStyleCollection.cs
- FrameworkObject.cs
- ThreadPool.cs
- TableItemPattern.cs
- ResetableIterator.cs
- DependencyPropertyValueSerializer.cs
- MeshGeometry3D.cs
- DocumentViewerHelper.cs
- CurrencyManager.cs
- CompModSwitches.cs
- CodeEntryPointMethod.cs
- ClientConfigurationSystem.cs
- MulticastNotSupportedException.cs
- ObjectDataSourceFilteringEventArgs.cs
- figurelengthconverter.cs
- SapiRecognizer.cs
- SafeNativeHandle.cs
- _FtpDataStream.cs
- mactripleDES.cs
- ReferencedAssemblyResolver.cs
- ConfigXmlText.cs
- FixedTextPointer.cs
- DelimitedListTraceListener.cs
- NavigateUrlConverter.cs
- RowVisual.cs
- ApplicationServiceManager.cs
- ObjectListComponentEditor.cs
- ToolStripPanelRow.cs
- XPathNodePointer.cs
- HandlerFactoryCache.cs
- BamlLocalizationDictionary.cs
- FrameworkElement.cs
- DelegatedStream.cs
- SafeRightsManagementQueryHandle.cs
- TrustLevelCollection.cs
- VectorCollectionValueSerializer.cs
- TextDecorations.cs
- RequestQueryParser.cs
- ToolZone.cs
- OracleDateTime.cs
- DelegateInArgument.cs
- MenuItemStyle.cs
- RSACryptoServiceProvider.cs
- Decoder.cs
- CommandLibraryHelper.cs
- Base64Decoder.cs
- AutomationIdentifierGuids.cs
- CompiledELinqQueryState.cs
- PermissionSetEnumerator.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- DifferencingCollection.cs
- SmiContext.cs
- RightsManagementInformation.cs
- LambdaCompiler.Statements.cs
- IgnoreDeviceFilterElement.cs
- CrossSiteScriptingValidation.cs
- SqlDataSource.cs
- DbConnectionPoolOptions.cs
- TransportBindingElementImporter.cs
- DesignerGeometryHelper.cs
- DashStyle.cs
- CompilerTypeWithParams.cs
- DoubleStorage.cs
- TypeLibConverter.cs
- BookmarkUndoUnit.cs
- LinqToSqlWrapper.cs
- SizeConverter.cs
- VisualStateManager.cs
- ClrPerspective.cs
- ComboBox.cs
- SafeNativeMethods.cs
- GroupBoxAutomationPeer.cs
- DataGridViewBand.cs
- XmlSchemaDocumentation.cs
- KeyNotFoundException.cs
- OleAutBinder.cs
- AttributeAction.cs
- ClientSettings.cs
- WaitForChangedResult.cs
- DynamicMethod.cs
- ToolboxDataAttribute.cs
- OleDbError.cs