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
- InkCanvasAutomationPeer.cs
- DrawListViewItemEventArgs.cs
- HttpHandlersInstallComponent.cs
- ICollection.cs
- WebPartDisplayMode.cs
- DataRowView.cs
- DatatypeImplementation.cs
- FormViewModeEventArgs.cs
- SystemTcpConnection.cs
- ManagementOperationWatcher.cs
- ImageInfo.cs
- DeviceOverridableAttribute.cs
- NativeMethods.cs
- FixUpCollection.cs
- DynamicDocumentPaginator.cs
- CodeBinaryOperatorExpression.cs
- GetReadStreamResult.cs
- NativeCompoundFileAPIs.cs
- OdbcDataReader.cs
- FileEnumerator.cs
- WinEventWrap.cs
- DbProviderFactory.cs
- EmissiveMaterial.cs
- TableLayoutStyle.cs
- EnumUnknown.cs
- TableRowCollection.cs
- BypassElement.cs
- TokenBasedSetEnumerator.cs
- DrawListViewItemEventArgs.cs
- SafeFileHandle.cs
- SafeNativeMethods.cs
- RightNameExpirationInfoPair.cs
- TextBoxAutomationPeer.cs
- CompModSwitches.cs
- RadialGradientBrush.cs
- ServiceDesigner.cs
- ConditionCollection.cs
- RepeaterItemCollection.cs
- ValidationPropertyAttribute.cs
- FormsAuthenticationCredentials.cs
- UnlockInstanceCommand.cs
- FileVersion.cs
- WindowsRichEdit.cs
- RC2.cs
- DataGridRowClipboardEventArgs.cs
- FixedSchema.cs
- UserInitiatedNavigationPermission.cs
- FillRuleValidation.cs
- XmlSchemaInfo.cs
- ToolStripSeparatorRenderEventArgs.cs
- _NTAuthentication.cs
- TextLineResult.cs
- FlowLayoutPanelDesigner.cs
- WmlControlAdapter.cs
- RangeBase.cs
- DbProviderFactory.cs
- ToolboxItemCollection.cs
- DataGridViewRowStateChangedEventArgs.cs
- NetCodeGroup.cs
- DeploymentSection.cs
- FontInfo.cs
- Emitter.cs
- SmiEventSink.cs
- RenderDataDrawingContext.cs
- RectangleHotSpot.cs
- Terminate.cs
- Separator.cs
- TreeNodeBindingCollection.cs
- PostBackOptions.cs
- UnsafeNativeMethods.cs
- PropertySourceInfo.cs
- Input.cs
- OperationAbortedException.cs
- IsolatedStorage.cs
- XmlBinaryReader.cs
- ScalarConstant.cs
- RequiredAttributeAttribute.cs
- MultiViewDesigner.cs
- Activity.cs
- PageHandlerFactory.cs
- FormsAuthenticationUser.cs
- SqlAliasesReferenced.cs
- SqlAliasesReferenced.cs
- RecognizerBase.cs
- VerbConverter.cs
- ImageListDesigner.cs
- XPathAncestorQuery.cs
- RelationshipEnd.cs
- OrderedDictionary.cs
- FileDialog.cs
- UniqueIdentifierService.cs
- Container.cs
- ComponentConverter.cs
- TreeNodeBindingCollection.cs
- HtmlTableCellCollection.cs
- ShaderRenderModeValidation.cs
- FontFamily.cs
- PartialArray.cs
- CacheOutputQuery.cs
- XmlQueryRuntime.cs