Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- RijndaelManaged.cs
- CompatibleComparer.cs
- ObjectDataSource.cs
- AlphabetConverter.cs
- Int32KeyFrameCollection.cs
- AsyncOperationManager.cs
- BufferedGraphics.cs
- TimeBoundedCache.cs
- EpmSourcePathSegment.cs
- ObjectConverter.cs
- PingReply.cs
- WebBrowsableAttribute.cs
- NavigationService.cs
- ScrollEventArgs.cs
- SigningCredentials.cs
- TextTreeInsertElementUndoUnit.cs
- RepeatBehavior.cs
- ContextMarshalException.cs
- SecurityPolicySection.cs
- FixedSOMTableCell.cs
- ViewStateModeByIdAttribute.cs
- EmissiveMaterial.cs
- FillRuleValidation.cs
- XmlSchemaExternal.cs
- Label.cs
- Walker.cs
- CompilationLock.cs
- UndoManager.cs
- CacheSection.cs
- ProcessHostMapPath.cs
- XmlComment.cs
- DisplayInformation.cs
- Size.cs
- DataGridViewBand.cs
- DateBoldEvent.cs
- AdapterUtil.cs
- DrawingImage.cs
- IsolatedStoragePermission.cs
- Line.cs
- SchemaEntity.cs
- TextRenderingModeValidation.cs
- ServiceDurableInstance.cs
- BinaryMethodMessage.cs
- QuaternionConverter.cs
- WebPart.cs
- ServiceOperationParameter.cs
- DbMetaDataColumnNames.cs
- TypeToken.cs
- GPPOINTF.cs
- CqlErrorHelper.cs
- SendMailErrorEventArgs.cs
- Boolean.cs
- TextEditorTyping.cs
- Geometry.cs
- SingleQueryOperator.cs
- SchemaExporter.cs
- CancelAsyncOperationRequest.cs
- BindingElementExtensionElement.cs
- WebPartPersonalization.cs
- DatagridviewDisplayedBandsData.cs
- UpdateTranslator.cs
- TaiwanLunisolarCalendar.cs
- ByteConverter.cs
- NativeMethods.cs
- ApplicationSecurityInfo.cs
- Image.cs
- HtmlTitle.cs
- StringFormat.cs
- LinqDataSourceUpdateEventArgs.cs
- WinInetCache.cs
- ListViewEditEventArgs.cs
- SqlException.cs
- TextSelectionHighlightLayer.cs
- RegexNode.cs
- TextRenderer.cs
- DataBindEngine.cs
- MethodBuilder.cs
- WindowsMenu.cs
- Operator.cs
- ClipboardProcessor.cs
- QueryExpression.cs
- WebMessageFormatHelper.cs
- ExpanderAutomationPeer.cs
- View.cs
- _SslStream.cs
- TCPClient.cs
- StylusDownEventArgs.cs
- ImageUrlEditor.cs
- AutoResizedEvent.cs
- ValidationErrorEventArgs.cs
- HandlerBase.cs
- XLinq.cs
- ExecutionContext.cs
- dsa.cs
- XmlSchemaSimpleContentRestriction.cs
- Query.cs
- CredentialManagerDialog.cs
- EnumerableValidator.cs
- IPAddressCollection.cs
- Timer.cs