Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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. // //----------------------------------------------------------------------------- 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
- DocumentApplicationJournalEntry.cs
- SystemFonts.cs
- SamlEvidence.cs
- ReliableOutputSessionChannel.cs
- LineServicesRun.cs
- CodeNamespace.cs
- SqlRecordBuffer.cs
- Point4D.cs
- SchemaObjectWriter.cs
- RtfNavigator.cs
- RotateTransform.cs
- NumericUpDown.cs
- MenuCommand.cs
- WorkflowViewService.cs
- DataGridViewCellStyleChangedEventArgs.cs
- PluralizationService.cs
- SoapParser.cs
- MediaElement.cs
- ByteStorage.cs
- XNameTypeConverter.cs
- UpdatePanelTrigger.cs
- TargetParameterCountException.cs
- HtmlImageAdapter.cs
- SubMenuStyleCollection.cs
- ProcessModelInfo.cs
- Rectangle.cs
- FunctionOverloadResolver.cs
- SR.cs
- ListViewGroup.cs
- FunctionNode.cs
- GatewayDefinition.cs
- CacheOutputQuery.cs
- ObjectDataProvider.cs
- SoapAttributes.cs
- HMAC.cs
- DataGridAutoFormat.cs
- ThreadStartException.cs
- HttpResponse.cs
- TimerEventSubscription.cs
- LockRecursionException.cs
- SplashScreen.cs
- DictionaryMarkupSerializer.cs
- Point.cs
- EntityContainerRelationshipSetEnd.cs
- Intellisense.cs
- FigureParaClient.cs
- ScrollProviderWrapper.cs
- SystemIPInterfaceProperties.cs
- WebPartDisplayModeCollection.cs
- ClientSponsor.cs
- ByteStack.cs
- ListCommandEventArgs.cs
- SqlDeflator.cs
- BaseCollection.cs
- Selector.cs
- EntityConnectionStringBuilderItem.cs
- Socket.cs
- SatelliteContractVersionAttribute.cs
- TextPatternIdentifiers.cs
- KnownTypeHelper.cs
- OptimalTextSource.cs
- Signature.cs
- XmlSchemaSimpleTypeRestriction.cs
- ServicePointManager.cs
- NameNode.cs
- HighContrastHelper.cs
- CharKeyFrameCollection.cs
- MulticastNotSupportedException.cs
- UserPersonalizationStateInfo.cs
- HtmlHistory.cs
- SupportingTokenChannel.cs
- PageTheme.cs
- XmlCollation.cs
- DataTableTypeConverter.cs
- EncryptedReference.cs
- SettingsPropertyIsReadOnlyException.cs
- RootBuilder.cs
- StateFinalizationActivity.cs
- AppDomainShutdownMonitor.cs
- uribuilder.cs
- GeometryGroup.cs
- EventLogTraceListener.cs
- SystemWebSectionGroup.cs
- SQLMembershipProvider.cs
- TreePrinter.cs
- WorkflowFileItem.cs
- UIElement3D.cs
- MemoryRecordBuffer.cs
- SHA384.cs
- BlurBitmapEffect.cs
- DataGridSortCommandEventArgs.cs
- UnsafeNativeMethods.cs
- MaterialCollection.cs
- UTF32Encoding.cs
- StringValidator.cs
- Expression.DebuggerProxy.cs
- SimpleApplicationHost.cs
- Errors.cs
- InputElement.cs
- DateTimeOffset.cs