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
- InkSerializer.cs
- COM2ExtendedUITypeEditor.cs
- ShaperBuffers.cs
- Attribute.cs
- TrackingRecord.cs
- CurrentTimeZone.cs
- LineGeometry.cs
- SectionRecord.cs
- XmlHelper.cs
- CqlWriter.cs
- Buffer.cs
- ReadOnlyHierarchicalDataSource.cs
- InstallerTypeAttribute.cs
- TextServicesContext.cs
- TraceFilter.cs
- XmlSerializer.cs
- ImportException.cs
- TranslateTransform.cs
- InheritanceContextHelper.cs
- ServiceActivationException.cs
- ElementHost.cs
- ObjectMaterializedEventArgs.cs
- ReadOnlyHierarchicalDataSourceView.cs
- XmlChoiceIdentifierAttribute.cs
- SafeFileMapViewHandle.cs
- OutArgument.cs
- SafeNativeMethods.cs
- MessageQueueEnumerator.cs
- CrossAppDomainChannel.cs
- RuleAttributes.cs
- TableStyle.cs
- PresentationUIStyleResources.cs
- Menu.cs
- Int32Rect.cs
- CurrentChangingEventArgs.cs
- CodeArrayIndexerExpression.cs
- WebPartDisplayModeEventArgs.cs
- BaseDataListComponentEditor.cs
- CompatibleComparer.cs
- SingleAnimationBase.cs
- FileSystemEnumerable.cs
- DataRelationCollection.cs
- EUCJPEncoding.cs
- ValueProviderWrapper.cs
- UriSectionReader.cs
- OperationAbortedException.cs
- PerformanceCounterPermissionAttribute.cs
- FontSizeConverter.cs
- AsyncCodeActivity.cs
- DesignerActionListCollection.cs
- QueryContinueDragEvent.cs
- BamlRecordReader.cs
- XamlToRtfWriter.cs
- DataGridItemCollection.cs
- QuotedStringFormatReader.cs
- ToolboxItem.cs
- HostingPreferredMapPath.cs
- ItemContainerGenerator.cs
- SqlLiftWhereClauses.cs
- WebInvokeAttribute.cs
- AnchoredBlock.cs
- ToolboxSnapDragDropEventArgs.cs
- Timer.cs
- XmlKeywords.cs
- XmlFormatExtensionPrefixAttribute.cs
- TextEditorTables.cs
- Model3D.cs
- ValidateNames.cs
- DataSvcMapFile.cs
- SafeRightsManagementQueryHandle.cs
- TreeViewCancelEvent.cs
- _ConnectOverlappedAsyncResult.cs
- HTMLTagNameToTypeMapper.cs
- RawAppCommandInputReport.cs
- GridEntry.cs
- TextTabProperties.cs
- GenericRootAutomationPeer.cs
- ProcessManager.cs
- FontInfo.cs
- ModuleBuilder.cs
- LoadedEvent.cs
- Grant.cs
- TextLine.cs
- ComplexTypeEmitter.cs
- DbProviderServices.cs
- DesignSurfaceEvent.cs
- CategoryGridEntry.cs
- DataGridColumnCollection.cs
- Activity.cs
- ObjectIDGenerator.cs
- NativeMethods.cs
- ReaderWriterLock.cs
- TreeViewHitTestInfo.cs
- WebPartVerbsEventArgs.cs
- DataGridViewToolTip.cs
- FilterQueryOptionExpression.cs
- Path.cs
- SoapUnknownHeader.cs
- OdbcHandle.cs
- Win32SafeHandles.cs