Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- DataServiceExpressionVisitor.cs
- LocatorBase.cs
- ConnectionPoint.cs
- ScopeElement.cs
- SpAudioStreamWrapper.cs
- HyperLinkStyle.cs
- TransformedBitmap.cs
- mediapermission.cs
- PersonalizationProviderHelper.cs
- DataGridRowsPresenter.cs
- MonthCalendar.cs
- BitmapImage.cs
- CodeDirectionExpression.cs
- XmlSerializer.cs
- XsdValidatingReader.cs
- basecomparevalidator.cs
- CatalogZone.cs
- CodeCommentStatement.cs
- FrameAutomationPeer.cs
- DataGridRowEventArgs.cs
- DownloadProgressEventArgs.cs
- ColumnResizeAdorner.cs
- SecurityUtils.cs
- HwndSourceParameters.cs
- _AutoWebProxyScriptHelper.cs
- ILGenerator.cs
- OperationInvokerBehavior.cs
- GlyphRunDrawing.cs
- DiscoveryClientDuplexChannel.cs
- SafeFileMappingHandle.cs
- ComboBoxDesigner.cs
- IfAction.cs
- RoleGroupCollection.cs
- WebPartAuthorizationEventArgs.cs
- EntityDataSourceValidationException.cs
- Descriptor.cs
- ConfigUtil.cs
- StreamGeometryContext.cs
- SelfSignedCertificate.cs
- HealthMonitoringSection.cs
- ByteAnimationUsingKeyFrames.cs
- AutomationTextAttribute.cs
- SignedXml.cs
- KeyValuePair.cs
- PackWebRequestFactory.cs
- Publisher.cs
- DataKey.cs
- ImageBrush.cs
- AuthorizationBehavior.cs
- ClusterRegistryConfigurationProvider.cs
- TextServicesLoader.cs
- StyleBamlRecordReader.cs
- PriorityRange.cs
- OleDbSchemaGuid.cs
- AbstractExpressions.cs
- DataTableMapping.cs
- HostingEnvironmentSection.cs
- FormViewDeletedEventArgs.cs
- ScrollBarAutomationPeer.cs
- PersistNameAttribute.cs
- ContextMenuStrip.cs
- ColumnResult.cs
- LinearGradientBrush.cs
- Propagator.Evaluator.cs
- OleDbConnectionInternal.cs
- LinqDataSourceView.cs
- TemplateBindingExpressionConverter.cs
- CollectionConverter.cs
- TcpSocketManager.cs
- _ListenerResponseStream.cs
- ResourceDisplayNameAttribute.cs
- TabItemAutomationPeer.cs
- RoleServiceManager.cs
- OneOfTypeConst.cs
- CompletedAsyncResult.cs
- AccessText.cs
- MessageDecoder.cs
- AuthenticationSection.cs
- ReadOnlyDataSource.cs
- FormatSettings.cs
- DisplayInformation.cs
- CommonDialog.cs
- SessionPageStatePersister.cs
- DataObjectSettingDataEventArgs.cs
- CommonEndpointBehaviorElement.cs
- WorkflowInstance.cs
- LinqDataSourceUpdateEventArgs.cs
- CodeArrayIndexerExpression.cs
- WebBrowserNavigatedEventHandler.cs
- PasswordRecovery.cs
- WebBrowser.cs
- HtmlContainerControl.cs
- HtmlInputControl.cs
- BitmapEffectInput.cs
- DataGridViewRowStateChangedEventArgs.cs
- ISAPIWorkerRequest.cs
- PaintEvent.cs
- X509Certificate.cs
- StylusPointDescription.cs
- EndpointIdentity.cs