Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyHierarchicalDataSource.cs / 1305376 / 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. // //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Table.cs
- ISAPIApplicationHost.cs
- SourceCollection.cs
- ClientOptions.cs
- DataListItemCollection.cs
- BinaryObjectReader.cs
- MobileControlBuilder.cs
- CopyAction.cs
- JumpList.cs
- TimeSpanStorage.cs
- BamlResourceContent.cs
- TreeViewCancelEvent.cs
- Nodes.cs
- ApplicationManager.cs
- RowSpanVector.cs
- DataComponentGenerator.cs
- SerializationException.cs
- InheritanceAttribute.cs
- FormatConvertedBitmap.cs
- TcpChannelFactory.cs
- AuthenticationModulesSection.cs
- HandledMouseEvent.cs
- XmlSignificantWhitespace.cs
- UriParserTemplates.cs
- XPathDocumentIterator.cs
- TextParaClient.cs
- ExternalException.cs
- XslNumber.cs
- EmptyCollection.cs
- PeerNameResolver.cs
- UpdatePanel.cs
- ListItemCollection.cs
- TreeViewDataItemAutomationPeer.cs
- PreservationFileWriter.cs
- DownloadProgressEventArgs.cs
- NonSerializedAttribute.cs
- EntityUtil.cs
- KoreanCalendar.cs
- DiagnosticTraceSource.cs
- RowTypeElement.cs
- CompilerWrapper.cs
- Polyline.cs
- HtmlTextBoxAdapter.cs
- IODescriptionAttribute.cs
- StaticExtension.cs
- Internal.cs
- ContentType.cs
- OleDragDropHandler.cs
- RegistryPermission.cs
- SqlBulkCopyColumnMappingCollection.cs
- FlowLayoutSettings.cs
- OdbcEnvironmentHandle.cs
- WorkflowViewElement.cs
- RegexInterpreter.cs
- OperationInvokerBehavior.cs
- ImageBrush.cs
- QilGeneratorEnv.cs
- BaseValidator.cs
- BooleanAnimationBase.cs
- CallSiteHelpers.cs
- AtomPub10CategoriesDocumentFormatter.cs
- MessageDecoder.cs
- TextOnlyOutput.cs
- EdgeModeValidation.cs
- XmlAnyElementAttribute.cs
- XamlHostingConfiguration.cs
- RenderingEventArgs.cs
- ExpandableObjectConverter.cs
- BitConverter.cs
- RowType.cs
- DrawingDrawingContext.cs
- documentsequencetextpointer.cs
- TableLayoutPanelCellPosition.cs
- ScanQueryOperator.cs
- TextEditorCharacters.cs
- ProfileEventArgs.cs
- EdmToObjectNamespaceMap.cs
- TypeGeneratedEventArgs.cs
- IChannel.cs
- SortAction.cs
- BamlLocalizabilityResolver.cs
- PatternMatchRules.cs
- FormsAuthenticationUserCollection.cs
- _ConnectStream.cs
- PopupRootAutomationPeer.cs
- PtsHelper.cs
- ListControlActionList.cs
- FontFaceLayoutInfo.cs
- Application.cs
- DataKey.cs
- CodeRegionDirective.cs
- TraceListeners.cs
- TreeNodeEventArgs.cs
- SettingsProperty.cs
- IdentifierService.cs
- TableRow.cs
- Monitor.cs
- XmlSerializer.cs
- StrokeNodeOperations.cs
- SqlDataSourceSelectingEventArgs.cs