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
- PathData.cs
- Int32KeyFrameCollection.cs
- MILUtilities.cs
- ExpandoObject.cs
- SelectionWordBreaker.cs
- DataGridViewRowCollection.cs
- AppDomainInfo.cs
- HeaderUtility.cs
- RemotingAttributes.cs
- ToolBarDesigner.cs
- OuterGlowBitmapEffect.cs
- EditorPartChrome.cs
- XXXOnTypeBuilderInstantiation.cs
- TextTreeNode.cs
- UnionExpr.cs
- XmlMtomWriter.cs
- _NegoStream.cs
- LoginDesignerUtil.cs
- TextSpan.cs
- DateTimeConverter2.cs
- EntityProviderFactory.cs
- Opcode.cs
- XslTransform.cs
- StatusBar.cs
- SqlDeflator.cs
- AbsoluteQuery.cs
- UndoManager.cs
- ResXResourceSet.cs
- DataDocumentXPathNavigator.cs
- LZCodec.cs
- XmlObjectSerializerReadContextComplex.cs
- ArrayList.cs
- BaseCodeDomTreeGenerator.cs
- PolyBezierSegmentFigureLogic.cs
- XPathExpr.cs
- CodeAccessPermission.cs
- SerialStream.cs
- WebOperationContext.cs
- AttributeQuery.cs
- SurrogateSelector.cs
- ResizeBehavior.cs
- ITextView.cs
- TemplatedAdorner.cs
- StoreItemCollection.Loader.cs
- ListComponentEditor.cs
- BrushConverter.cs
- CompletedAsyncResult.cs
- EmptyCollection.cs
- PagePropertiesChangingEventArgs.cs
- TreeNodeSelectionProcessor.cs
- KeyedHashAlgorithm.cs
- TabControlEvent.cs
- VerificationAttribute.cs
- StaticExtension.cs
- DrawingContextWalker.cs
- ToolStripDropDownClosedEventArgs.cs
- DetailsViewDeleteEventArgs.cs
- HttpRuntime.cs
- HtmlTextArea.cs
- RangeValidator.cs
- PeerNameRegistration.cs
- DiscoveryMessageSequenceCD1.cs
- ProcessModule.cs
- AttributeXamlType.cs
- MenuCommandService.cs
- SqlNotificationRequest.cs
- CatalogPartChrome.cs
- SortedDictionary.cs
- PropertyPathWorker.cs
- PKCS1MaskGenerationMethod.cs
- ButtonStandardAdapter.cs
- CurrencyWrapper.cs
- ResourceReferenceExpressionConverter.cs
- ActivityTypeResolver.xaml.cs
- SqlCacheDependencyDatabase.cs
- DbProviderFactories.cs
- AutoScrollHelper.cs
- StandardTransformFactory.cs
- ReferencedCollectionType.cs
- CompiledQuery.cs
- SamlAuthorityBinding.cs
- ByteStream.cs
- Color.cs
- ShortcutKeysEditor.cs
- RootContext.cs
- AttachedPropertyDescriptor.cs
- HMACSHA384.cs
- FormClosingEvent.cs
- WebContentFormatHelper.cs
- VirtualPathUtility.cs
- SQLBoolean.cs
- XmlSchemaSimpleTypeUnion.cs
- SqlUdtInfo.cs
- MultiView.cs
- ToolStripControlHost.cs
- FontConverter.cs
- OpacityConverter.cs
- WebServiceData.cs
- ReachDocumentReferenceSerializer.cs
- WindowsUpDown.cs