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
- WindowsNonControl.cs
- FontSource.cs
- DispatcherExceptionFilterEventArgs.cs
- EncodedStreamFactory.cs
- UIElementAutomationPeer.cs
- NamedPipeConnectionPoolSettingsElement.cs
- EmptyEnumerator.cs
- PermissionListSet.cs
- WindowsTokenRoleProvider.cs
- PartitionedStreamMerger.cs
- BamlLocalizableResource.cs
- CodeDirectiveCollection.cs
- ActivityExecutor.cs
- StreamGeometry.cs
- FixedSOMLineRanges.cs
- CharStorage.cs
- RawStylusInputCustomDataList.cs
- ObjectSet.cs
- ProfileModule.cs
- OracleConnectionFactory.cs
- JsonByteArrayDataContract.cs
- Color.cs
- BatchStream.cs
- RoleGroup.cs
- DateTimeOffsetStorage.cs
- ValidatingPropertiesEventArgs.cs
- FormViewUpdateEventArgs.cs
- SelectedCellsChangedEventArgs.cs
- ContentPathSegment.cs
- XmlElementAttributes.cs
- Validator.cs
- XmlCharType.cs
- VerifyHashRequest.cs
- ParentUndoUnit.cs
- GlobalEventManager.cs
- BuilderElements.cs
- TableParagraph.cs
- DataGridCommandEventArgs.cs
- AesCryptoServiceProvider.cs
- EventListenerClientSide.cs
- RegexBoyerMoore.cs
- ITextView.cs
- BufferModesCollection.cs
- SqlMethodCallConverter.cs
- DbConnectionInternal.cs
- CachedBitmap.cs
- Endpoint.cs
- MultipartContentParser.cs
- SqlInternalConnectionSmi.cs
- LeafCellTreeNode.cs
- WebConfigurationHost.cs
- CheckBoxFlatAdapter.cs
- TextEditor.cs
- InfiniteIntConverter.cs
- EventLogPermissionAttribute.cs
- MimeTypeMapper.cs
- DataTableClearEvent.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ServiceCredentialsSecurityTokenManager.cs
- SecurityAccessDeniedException.cs
- SystemParameters.cs
- Mouse.cs
- TransformerInfo.cs
- SystemColors.cs
- Utilities.cs
- Error.cs
- CrossContextChannel.cs
- SequenceDesigner.cs
- ExpandableObjectConverter.cs
- DataBindingHandlerAttribute.cs
- CardSpacePolicyElement.cs
- InteropAutomationProvider.cs
- LocatorBase.cs
- Calendar.cs
- TreeNodeBindingDepthConverter.cs
- PeerApplicationLaunchInfo.cs
- EntityContainerEmitter.cs
- NonParentingControl.cs
- Debugger.cs
- GeometryConverter.cs
- ObjectList.cs
- FixedSOMFixedBlock.cs
- DesignerSerializationManager.cs
- Identifier.cs
- Base64Decoder.cs
- QuerySettings.cs
- BodyGlyph.cs
- TransactionInterop.cs
- QueryInterceptorAttribute.cs
- MethodBody.cs
- SmtpSection.cs
- DrawingDrawingContext.cs
- MulticastIPAddressInformationCollection.cs
- DebuggerAttributes.cs
- XmlElementAttributes.cs
- ImageAttributes.cs
- TabControlEvent.cs
- DataBindingCollectionEditor.cs
- xsdvalidator.cs
- TypeHelper.cs