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
- SqlDataSourceCommandEventArgs.cs
- PropertyItemInternal.cs
- FixedTextPointer.cs
- HTMLTextWriter.cs
- WorkItem.cs
- CryptoApi.cs
- NavigationProperty.cs
- SafeRegistryHandle.cs
- ClientApiGenerator.cs
- TemplatePropertyEntry.cs
- HyperLinkColumn.cs
- EventSinkHelperWriter.cs
- RequestCachePolicy.cs
- wgx_sdk_version.cs
- BrowserInteropHelper.cs
- WebBrowserNavigatedEventHandler.cs
- ScriptReferenceEventArgs.cs
- FilterFactory.cs
- LocatorGroup.cs
- SmiEventSink_DeferedProcessing.cs
- _DomainName.cs
- SystemColors.cs
- WasHostedComPlusFactory.cs
- SetterBase.cs
- XmlHierarchyData.cs
- SchemaTableOptionalColumn.cs
- WorkflowDesigner.cs
- TextParagraphProperties.cs
- TypeResolver.cs
- WsatConfiguration.cs
- StructuralType.cs
- ServiceMetadataPublishingElement.cs
- ObjectDataSourceStatusEventArgs.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- HwndStylusInputProvider.cs
- HealthMonitoringSectionHelper.cs
- TrayIconDesigner.cs
- ASCIIEncoding.cs
- MouseButtonEventArgs.cs
- QuarticEase.cs
- EntityConnectionStringBuilder.cs
- CryptoApi.cs
- ViewStateAttachedPropertyFeature.cs
- PreservationFileReader.cs
- SystemIcmpV6Statistics.cs
- AssemblySettingAttributes.cs
- IntSecurity.cs
- EventKeyword.cs
- PersistChildrenAttribute.cs
- ComponentResourceManager.cs
- CodeAccessSecurityEngine.cs
- XmlUTF8TextReader.cs
- AlternateView.cs
- ParserStreamGeometryContext.cs
- AliasGenerator.cs
- EntityType.cs
- EmptyElement.cs
- login.cs
- DataRowView.cs
- RegistryDataKey.cs
- RuleCache.cs
- SafeFindHandle.cs
- FixedHyperLink.cs
- EditorZoneBase.cs
- BooleanFacetDescriptionElement.cs
- SHA256.cs
- ValidateNames.cs
- FlowDecisionLabelFeature.cs
- SQLDateTime.cs
- RegexWorker.cs
- RevocationPoint.cs
- FormViewUpdatedEventArgs.cs
- WriterOutput.cs
- IdlingCommunicationPool.cs
- VirtualPathProvider.cs
- MessagePartDescriptionCollection.cs
- PointCollection.cs
- FieldNameLookup.cs
- translator.cs
- WebBrowserDocumentCompletedEventHandler.cs
- JoinElimination.cs
- DbParameterCollectionHelper.cs
- MsmqHostedTransportConfiguration.cs
- TreeWalkHelper.cs
- CacheDependency.cs
- CompositeActivityTypeDescriptor.cs
- EventHandlers.cs
- HtmlFormAdapter.cs
- ToolStripSeparatorRenderEventArgs.cs
- PKCS1MaskGenerationMethod.cs
- DataGridViewAdvancedBorderStyle.cs
- _IPv6Address.cs
- InvalidTimeZoneException.cs
- FillBehavior.cs
- MappingMetadataHelper.cs
- AttributeCallbackBuilder.cs
- RIPEMD160.cs
- TableItemProviderWrapper.cs
- DocumentOrderComparer.cs
- SystemWebCachingSectionGroup.cs