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
- ExpressionParser.cs
- CodePropertyReferenceExpression.cs
- Label.cs
- ControlCollection.cs
- MimeMapping.cs
- SQLByteStorage.cs
- ListViewItem.cs
- WebPartConnectionsConfigureVerb.cs
- CheckableControlBaseAdapter.cs
- PipelineDeploymentState.cs
- RelatedImageListAttribute.cs
- BitmapDecoder.cs
- MimePart.cs
- NumberAction.cs
- SessionStateUtil.cs
- InitializationEventAttribute.cs
- SwitchLevelAttribute.cs
- ReliableOutputSessionChannel.cs
- OdbcDataAdapter.cs
- PreviewKeyDownEventArgs.cs
- GeometryHitTestResult.cs
- SelectionItemPattern.cs
- DomainUpDown.cs
- WebScriptMetadataFormatter.cs
- PolicyValidationException.cs
- ContextMarshalException.cs
- CornerRadiusConverter.cs
- StringFormat.cs
- CompositeDataBoundControl.cs
- Vector3DValueSerializer.cs
- CompModSwitches.cs
- CompiledXpathExpr.cs
- VisualTreeHelper.cs
- HGlobalSafeHandle.cs
- ColumnReorderedEventArgs.cs
- PrefixHandle.cs
- DBCommandBuilder.cs
- ToolStripGripRenderEventArgs.cs
- XsltArgumentList.cs
- ServerValidateEventArgs.cs
- sqlmetadatafactory.cs
- CommandPlan.cs
- PointF.cs
- TypeUtil.cs
- ThreadExceptionDialog.cs
- XmlSignificantWhitespace.cs
- TokenizerHelper.cs
- Viewport3DAutomationPeer.cs
- DataGridViewSelectedRowCollection.cs
- ParameterCollection.cs
- MaskPropertyEditor.cs
- ContextMenuStrip.cs
- DaylightTime.cs
- TPLETWProvider.cs
- ToolBarTray.cs
- ImportedNamespaceContextItem.cs
- DataServiceContext.cs
- DataList.cs
- XslCompiledTransform.cs
- Vector3DIndependentAnimationStorage.cs
- BindUriHelper.cs
- TextEditorMouse.cs
- GridViewRow.cs
- SafeSerializationManager.cs
- XhtmlCssHandler.cs
- RightsManagementPermission.cs
- ObjectComplexPropertyMapping.cs
- TextElementEnumerator.cs
- AuthenticationService.cs
- PreviewPageInfo.cs
- ListItemParagraph.cs
- EUCJPEncoding.cs
- ParameterReplacerVisitor.cs
- OracleInfoMessageEventArgs.cs
- PeerInputChannelListener.cs
- Operator.cs
- TextSearch.cs
- SecurityKeyIdentifierClause.cs
- Constant.cs
- MutableAssemblyCacheEntry.cs
- FormsAuthenticationEventArgs.cs
- BamlVersionHeader.cs
- TreeViewCancelEvent.cs
- SyncOperationState.cs
- RtType.cs
- Int32KeyFrameCollection.cs
- VariableExpressionConverter.cs
- StringUtil.cs
- StatusStrip.cs
- OperationExecutionFault.cs
- UnhandledExceptionEventArgs.cs
- TreeViewBindingsEditorForm.cs
- AudioFormatConverter.cs
- DoubleUtil.cs
- Symbol.cs
- SBCSCodePageEncoding.cs
- Knowncolors.cs
- ClientBuildManagerCallback.cs
- CacheSection.cs
- Argument.cs