Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyHierarchicalDataSource.cs / 1 / ReadOnlyHierarchicalDataSource.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Web; using System.Web.UI; using System.Web.Util; ////// Helper class for hierarchical data bound controls to wrap an generic /// data source with a strongly typed IHierarchicalDataSource. This class /// automatically handles other IHierarchicalDataSources and /// IHierarchicalEnumerables. This class uses /// ReadOnlyHierarchicalDataSourceView to represent individual views. /// internal sealed class ReadOnlyHierarchicalDataSource : IHierarchicalDataSource { private object _dataSource; public ReadOnlyHierarchicalDataSource(object dataSource) { Debug.Assert(dataSource == null || (dataSource is IHierarchicalEnumerable || dataSource is IHierarchicalDataSource), "Expected dataSource to be either null, an IHierarchicalEnumerable, or an IHierarchicalDataSource."); _dataSource = dataSource; } #region Implementation of IHierarchicalDataSource event EventHandler IHierarchicalDataSource.DataSourceChanged { add { } remove { } } ////// Check for IHierarchicalDataSource and IHierarchicalEnumerable, and /// return an approprite HierarchicalDataSourceView. /// HierarchicalDataSourceView IHierarchicalDataSource.GetHierarchicalView(string viewPath) { // Check first for IHierarchicalDataSource IHierarchicalDataSource ds = _dataSource as IHierarchicalDataSource; if (ds != null) { return ds.GetHierarchicalView(viewPath); } IHierarchicalEnumerable enumerable = _dataSource as IHierarchicalEnumerable; if (enumerable != null && viewPath != null && viewPath.Length != 0) { throw new InvalidOperationException(SR.GetString(SR.ReadOnlyHierarchicalDataSourceView_CantAccessPathInEnumerable)); } return new ReadOnlyHierarchicalDataSourceView(enumerable); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.Collections; using System.ComponentModel; using System.Web; using System.Web.UI; using System.Web.Util; ////// Helper class for hierarchical data bound controls to wrap an generic /// data source with a strongly typed IHierarchicalDataSource. This class /// automatically handles other IHierarchicalDataSources and /// IHierarchicalEnumerables. This class uses /// ReadOnlyHierarchicalDataSourceView to represent individual views. /// internal sealed class ReadOnlyHierarchicalDataSource : IHierarchicalDataSource { private object _dataSource; public ReadOnlyHierarchicalDataSource(object dataSource) { Debug.Assert(dataSource == null || (dataSource is IHierarchicalEnumerable || dataSource is IHierarchicalDataSource), "Expected dataSource to be either null, an IHierarchicalEnumerable, or an IHierarchicalDataSource."); _dataSource = dataSource; } #region Implementation of IHierarchicalDataSource event EventHandler IHierarchicalDataSource.DataSourceChanged { add { } remove { } } ////// Check for IHierarchicalDataSource and IHierarchicalEnumerable, and /// return an approprite HierarchicalDataSourceView. /// HierarchicalDataSourceView IHierarchicalDataSource.GetHierarchicalView(string viewPath) { // Check first for IHierarchicalDataSource IHierarchicalDataSource ds = _dataSource as IHierarchicalDataSource; if (ds != null) { return ds.GetHierarchicalView(viewPath); } IHierarchicalEnumerable enumerable = _dataSource as IHierarchicalEnumerable; if (enumerable != null && viewPath != null && viewPath.Length != 0) { throw new InvalidOperationException(SR.GetString(SR.ReadOnlyHierarchicalDataSourceView_CantAccessPathInEnumerable)); } return new ReadOnlyHierarchicalDataSourceView(enumerable); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Point4D.cs
- OracleBFile.cs
- ErasingStroke.cs
- UIElementAutomationPeer.cs
- MetadataConversionError.cs
- GuidelineSet.cs
- EventTrigger.cs
- WebPartDescription.cs
- WhereaboutsReader.cs
- AttributeEmitter.cs
- Padding.cs
- XPathMultyIterator.cs
- SerialReceived.cs
- WorkflowInstance.cs
- ObjectDataProvider.cs
- ToolStripSeparatorRenderEventArgs.cs
- FixedDocumentSequencePaginator.cs
- ThrowHelper.cs
- CurrencyManager.cs
- GeometryHitTestParameters.cs
- FolderBrowserDialog.cs
- TextBoxBase.cs
- QualificationDataAttribute.cs
- RadioButtonAutomationPeer.cs
- NameScopePropertyAttribute.cs
- ProvidePropertyAttribute.cs
- DispatcherSynchronizationContext.cs
- CancellationHandlerDesigner.cs
- SR.cs
- ServiceDescriptionSerializer.cs
- DataControlFieldCollection.cs
- Error.cs
- ResourceLoader.cs
- MouseCaptureWithinProperty.cs
- DesignTimeTemplateParser.cs
- DbDataReader.cs
- DelayedRegex.cs
- GeneralTransform2DTo3DTo2D.cs
- CompilationUtil.cs
- Processor.cs
- CryptoApi.cs
- XmlSchemaInferenceException.cs
- NotifyCollectionChangedEventArgs.cs
- HTTPNotFoundHandler.cs
- ToolStripItemDataObject.cs
- XMLSyntaxException.cs
- SecUtil.cs
- SessionStateContainer.cs
- Image.cs
- Lease.cs
- SystemDropShadowChrome.cs
- NonSerializedAttribute.cs
- SystemSounds.cs
- VBCodeProvider.cs
- HeaderElement.cs
- MemberBinding.cs
- RelatedView.cs
- ThicknessAnimationBase.cs
- ScriptControlDescriptor.cs
- CodeDelegateInvokeExpression.cs
- FixedSOMLineRanges.cs
- GlobalizationSection.cs
- XmlSchemaComplexContentExtension.cs
- AttachedAnnotation.cs
- MaskedTextBox.cs
- WebPartPersonalization.cs
- SelectionEditingBehavior.cs
- _DigestClient.cs
- FrameworkRichTextComposition.cs
- DoubleLinkListEnumerator.cs
- InkCanvasSelection.cs
- CodeDOMProvider.cs
- PolyLineSegmentFigureLogic.cs
- TimeStampChecker.cs
- _FtpControlStream.cs
- Console.cs
- RelationshipEnd.cs
- QueryAccessibilityHelpEvent.cs
- PrivateFontCollection.cs
- CodeSubDirectory.cs
- AutomationPropertyInfo.cs
- BoundPropertyEntry.cs
- FrameworkContentElement.cs
- HitTestParameters.cs
- StatusBarPanelClickEvent.cs
- DurationConverter.cs
- WebPartConnectionCollection.cs
- TextRangeEdit.cs
- HierarchicalDataBoundControl.cs
- BackgroundFormatInfo.cs
- TableSectionStyle.cs
- QilTargetType.cs
- DecimalConverter.cs
- ImageListUtils.cs
- MailHeaderInfo.cs
- SemanticKeyElement.cs
- SimpleHandlerFactory.cs
- QilXmlReader.cs
- MsmqInputChannelListener.cs
- TypeUtil.cs