Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- FacetDescriptionElement.cs
- infer.cs
- ManifestSignatureInformation.cs
- SystemIcmpV4Statistics.cs
- TypeContext.cs
- Encoding.cs
- AmbientLight.cs
- NativeMethodsOther.cs
- LineVisual.cs
- CodeEventReferenceExpression.cs
- TextUtf8RawTextWriter.cs
- WindowPattern.cs
- _NegoState.cs
- DataTableCollection.cs
- DocumentXPathNavigator.cs
- FigureParaClient.cs
- httpserverutility.cs
- __Filters.cs
- CommandDevice.cs
- WebPartMenu.cs
- ListBindingHelper.cs
- ListViewGroup.cs
- Oid.cs
- UpdateProgress.cs
- RequestTimeoutManager.cs
- DataProtection.cs
- CroppedBitmap.cs
- FuncCompletionCallbackWrapper.cs
- ChildDocumentBlock.cs
- COMException.cs
- HttpDictionary.cs
- MenuEventArgs.cs
- CodeNamespaceImport.cs
- HttpWrapper.cs
- DataTemplateKey.cs
- ContainerUIElement3D.cs
- Propagator.cs
- FolderBrowserDialog.cs
- SignerInfo.cs
- CodeMethodInvokeExpression.cs
- NonVisualControlAttribute.cs
- FullTextLine.cs
- GradientStop.cs
- SchemaNotation.cs
- NativeMethods.cs
- DefaultValueTypeConverter.cs
- NamedPipeTransportSecurity.cs
- WebContext.cs
- EventProviderClassic.cs
- Image.cs
- RoleManagerModule.cs
- DrawingAttributesDefaultValueFactory.cs
- TextureBrush.cs
- Processor.cs
- CustomActivityDesigner.cs
- MTConfigUtil.cs
- BasicHttpSecurityMode.cs
- SignedPkcs7.cs
- SqlCacheDependencySection.cs
- ContentIterators.cs
- Brushes.cs
- ImportCatalogPart.cs
- MDIControlStrip.cs
- LingerOption.cs
- HashLookup.cs
- InputScope.cs
- ArcSegment.cs
- dataprotectionpermissionattribute.cs
- ServiceHostingEnvironment.cs
- BaseProcessor.cs
- Int32Rect.cs
- TextBoxAutoCompleteSourceConverter.cs
- CodeMethodMap.cs
- DataViewSettingCollection.cs
- ELinqQueryState.cs
- WsatAdminException.cs
- EventHandlerList.cs
- WindowsListViewGroupHelper.cs
- MenuItemBinding.cs
- FixedPage.cs
- TabItemAutomationPeer.cs
- XsdDuration.cs
- ArrangedElementCollection.cs
- CountdownEvent.cs
- AsyncOperation.cs
- MapPathBasedVirtualPathProvider.cs
- WebServiceData.cs
- EnumConverter.cs
- PolygonHotSpot.cs
- ComponentConverter.cs
- DrawingState.cs
- XmlRootAttribute.cs
- WebPartConnectVerb.cs
- DataException.cs
- AssociationSetMetadata.cs
- DataMemberConverter.cs
- _ProxyChain.cs
- CodePageUtils.cs
- FormViewPageEventArgs.cs
- ArraySubsetEnumerator.cs