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
- EncoderReplacementFallback.cs
- XmlValidatingReader.cs
- CssClassPropertyAttribute.cs
- AssociativeAggregationOperator.cs
- MouseBinding.cs
- NavigationProperty.cs
- EngineSite.cs
- SByteStorage.cs
- SortedDictionary.cs
- NotSupportedException.cs
- MatchingStyle.cs
- DeclaredTypeValidatorAttribute.cs
- FormViewPagerRow.cs
- RenderDataDrawingContext.cs
- NamespaceEmitter.cs
- FaultHandlingFilter.cs
- WorkflowInstanceProxy.cs
- DocumentXPathNavigator.cs
- WeakReferenceEnumerator.cs
- Double.cs
- SamlAction.cs
- BoolExpressionVisitors.cs
- Range.cs
- CopyNodeSetAction.cs
- Utils.cs
- RadioButton.cs
- SchemaDeclBase.cs
- StylusPoint.cs
- CodePageUtils.cs
- ResourceDictionary.cs
- ArrayWithOffset.cs
- DataGridTable.cs
- StandardMenuStripVerb.cs
- DataGridViewColumnHeaderCell.cs
- SqlCacheDependencyDatabase.cs
- ManageRequest.cs
- Nullable.cs
- PerformanceCounterLib.cs
- RegistrySecurity.cs
- coordinatorscratchpad.cs
- PropertyValueUIItem.cs
- StateMachineAction.cs
- Knowncolors.cs
- DataGridTextColumn.cs
- FtpWebResponse.cs
- DeferredElementTreeState.cs
- XslCompiledTransform.cs
- WebPartEditVerb.cs
- NotImplementedException.cs
- ListItemCollection.cs
- DbParameterHelper.cs
- SafeArrayRankMismatchException.cs
- HtmlInputFile.cs
- ImageSource.cs
- SecurityTimestamp.cs
- InvalidFilterCriteriaException.cs
- SqlGatherConsumedAliases.cs
- ToolStripLocationCancelEventArgs.cs
- ExpressionTable.cs
- TextEditorParagraphs.cs
- ObjectSecurity.cs
- ComponentCollection.cs
- AutomationIdentifier.cs
- RecordsAffectedEventArgs.cs
- WorkflowApplicationAbortedException.cs
- Token.cs
- BrowsableAttribute.cs
- dataprotectionpermission.cs
- RuntimeCompatibilityAttribute.cs
- FacetValues.cs
- LayoutDump.cs
- EntityParameter.cs
- LoadedEvent.cs
- _DomainName.cs
- PageParser.cs
- CapacityStreamGeometryContext.cs
- LayoutDump.cs
- _DigestClient.cs
- Bezier.cs
- CodeDirectoryCompiler.cs
- X509RecipientCertificateServiceElement.cs
- PinnedBufferMemoryStream.cs
- ProxyElement.cs
- InputMethod.cs
- OdbcPermission.cs
- PanelStyle.cs
- HWStack.cs
- EnumConverter.cs
- ObjectNotFoundException.cs
- Double.cs
- FrameworkRichTextComposition.cs
- ServicePointManagerElement.cs
- ConfigurationLocationCollection.cs
- ClientSideQueueItem.cs
- XmlnsPrefixAttribute.cs
- InnerItemCollectionView.cs
- ClosableStream.cs
- PathFigure.cs
- ParseHttpDate.cs
- Keywords.cs