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
- ScrollChrome.cs
- SourceFilter.cs
- TypeElement.cs
- ADMembershipUser.cs
- RelatedCurrencyManager.cs
- TypeHelper.cs
- WebDescriptionAttribute.cs
- SkipQueryOptionExpression.cs
- ConfigurationElementProperty.cs
- DateTime.cs
- TableLayoutSettings.cs
- PngBitmapEncoder.cs
- TimeSpan.cs
- ImageBrush.cs
- Calendar.cs
- XmlIlTypeHelper.cs
- mediaeventshelper.cs
- MaterializeFromAtom.cs
- RetrieveVirtualItemEventArgs.cs
- Control.cs
- DBBindings.cs
- SqlTopReducer.cs
- SizeConverter.cs
- CqlParser.cs
- CurrentTimeZone.cs
- TextContainer.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- AppDomainAttributes.cs
- DrawListViewItemEventArgs.cs
- Binding.cs
- CodeExpressionCollection.cs
- CacheMemory.cs
- UIElementPropertyUndoUnit.cs
- XpsPackagingPolicy.cs
- ToolBarTray.cs
- Attribute.cs
- Guid.cs
- DynamicControlParameter.cs
- WebEvents.cs
- UnknownBitmapEncoder.cs
- CatalogZone.cs
- CompiledWorkflowDefinitionContext.cs
- HashCryptoHandle.cs
- MostlySingletonList.cs
- ScriptIgnoreAttribute.cs
- WasAdminWrapper.cs
- DictionaryEntry.cs
- PanelDesigner.cs
- httpapplicationstate.cs
- Events.cs
- LoadedOrUnloadedOperation.cs
- LogRestartAreaEnumerator.cs
- FontNamesConverter.cs
- SqlErrorCollection.cs
- ValueType.cs
- Events.cs
- TextRunTypographyProperties.cs
- AnonymousIdentificationSection.cs
- MessageContractImporter.cs
- DurableRuntimeValidator.cs
- ConfigXmlElement.cs
- CollectionViewGroupRoot.cs
- HtmlFormAdapter.cs
- SmiMetaDataProperty.cs
- XmlSchemas.cs
- IMembershipProvider.cs
- SchemaImporter.cs
- TagPrefixInfo.cs
- ContextActivityUtils.cs
- HandleRef.cs
- FormViewDeleteEventArgs.cs
- ThreadStateException.cs
- PropertyPathConverter.cs
- IImplicitResourceProvider.cs
- AdornerDecorator.cs
- StreamResourceInfo.cs
- ExpressionVisitor.cs
- SpellerHighlightLayer.cs
- SrgsOneOf.cs
- ThemeDirectoryCompiler.cs
- InsufficientMemoryException.cs
- OdbcParameterCollection.cs
- SettingsBindableAttribute.cs
- EntitySetDataBindingList.cs
- DropDownList.cs
- RealProxy.cs
- BoolExpression.cs
- WebRequestModuleElement.cs
- Polyline.cs
- PresentationSource.cs
- BoundingRectTracker.cs
- StrokeNodeData.cs
- SchemaReference.cs
- NumericUpDownAccelerationCollection.cs
- ListBindableAttribute.cs
- EdmFunction.cs
- InkPresenterAutomationPeer.cs
- ReferenceService.cs
- newitemfactory.cs
- GlobalEventManager.cs