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
- DiscardableAttribute.cs
- _NativeSSPI.cs
- SqlUserDefinedTypeAttribute.cs
- RangeValuePatternIdentifiers.cs
- XmlNode.cs
- Marshal.cs
- ScopedKnownTypes.cs
- DocumentationServerProtocol.cs
- CfgRule.cs
- DataKey.cs
- XmlObjectSerializerContext.cs
- XmlValueConverter.cs
- CuspData.cs
- RelatedPropertyManager.cs
- DataFieldCollectionEditor.cs
- UdpContractFilterBehavior.cs
- BamlResourceSerializer.cs
- Matrix3DValueSerializer.cs
- PermissionToken.cs
- ObjectDataSourceSelectingEventArgs.cs
- ScrollData.cs
- WorkflowControlClient.cs
- GC.cs
- _LoggingObject.cs
- FrameworkContextData.cs
- IntSecurity.cs
- ImageBrush.cs
- EditorPartCollection.cs
- UITypeEditor.cs
- FontStretchConverter.cs
- ToolStrip.cs
- Condition.cs
- Request.cs
- ToolStripTextBox.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- IdentityValidationException.cs
- ThemeDirectoryCompiler.cs
- RelatedEnd.cs
- Helpers.cs
- CharUnicodeInfo.cs
- DefaultBindingPropertyAttribute.cs
- SoapSchemaImporter.cs
- Action.cs
- Registration.cs
- HtmlLabelAdapter.cs
- ISAPIApplicationHost.cs
- OutputCacheProfileCollection.cs
- ColumnResizeUndoUnit.cs
- RegexInterpreter.cs
- ImageDrawing.cs
- PersonalizationAdministration.cs
- BrushValueSerializer.cs
- StylusPointProperty.cs
- Pen.cs
- URLBuilder.cs
- SspiNegotiationTokenProviderState.cs
- MaterialCollection.cs
- TextSelection.cs
- EmptyEnumerator.cs
- EtwTrace.cs
- PartialCachingControl.cs
- GradientStopCollection.cs
- BezierSegment.cs
- ControlBuilder.cs
- TextEditorLists.cs
- FixedDocumentPaginator.cs
- MeasureItemEvent.cs
- DateTimeConstantAttribute.cs
- ParameterDataSourceExpression.cs
- Table.cs
- ImageSource.cs
- Faults.cs
- SQLGuid.cs
- Transform3DGroup.cs
- NetworkStream.cs
- XsltSettings.cs
- BitmapPalettes.cs
- Mouse.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- Vertex.cs
- FocusWithinProperty.cs
- IImplicitResourceProvider.cs
- StringStorage.cs
- HttpListenerPrefixCollection.cs
- ReflectionUtil.cs
- SmiRequestExecutor.cs
- BookmarkScope.cs
- NativeCppClassAttribute.cs
- MinimizableAttributeTypeConverter.cs
- OdbcPermission.cs
- RegexWorker.cs
- FrameworkElementAutomationPeer.cs
- CodeTypeDeclarationCollection.cs
- RequestUriProcessor.cs
- CurrentTimeZone.cs
- FixUpCollection.cs
- Trace.cs
- SchemaMapping.cs
- CollectionViewProxy.cs
- DataBoundControl.cs