Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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 } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HighlightComponent.cs
- DataSourceXmlElementAttribute.cs
- PackageRelationshipSelector.cs
- IChannel.cs
- ImpersonationOption.cs
- VectorValueSerializer.cs
- HtmlInputText.cs
- IsolatedStorageFilePermission.cs
- URLIdentityPermission.cs
- CalendarBlackoutDatesCollection.cs
- LoginNameDesigner.cs
- SqlFacetAttribute.cs
- Property.cs
- ItemsPresenter.cs
- SelectionGlyphBase.cs
- AppDomainGrammarProxy.cs
- LayoutExceptionEventArgs.cs
- EncoderReplacementFallback.cs
- MsmqIntegrationProcessProtocolHandler.cs
- NetTcpBindingCollectionElement.cs
- tooltip.cs
- _SingleItemRequestCache.cs
- MenuScrollingVisibilityConverter.cs
- CodeSnippetTypeMember.cs
- CompilerParameters.cs
- RegistryPermission.cs
- NumericUpDownAcceleration.cs
- Model3D.cs
- InkCanvasSelection.cs
- OutputCacheModule.cs
- HopperCache.cs
- OleServicesContext.cs
- AdjustableArrowCap.cs
- LinqDataSourceContextEventArgs.cs
- _DynamicWinsockMethods.cs
- ProfilePropertySettings.cs
- PersonalizationProviderCollection.cs
- StrokeNodeData.cs
- DirectionalLight.cs
- Drawing.cs
- Simplifier.cs
- VariantWrapper.cs
- BodyWriter.cs
- TreeBuilderBamlTranslator.cs
- PenThreadWorker.cs
- ClientApiGenerator.cs
- GroupStyle.cs
- PartialList.cs
- DefaultMemberAttribute.cs
- DelayedRegex.cs
- CultureInfoConverter.cs
- CodeBlockBuilder.cs
- FlowDocumentPageViewerAutomationPeer.cs
- BitmapEffect.cs
- BoundingRectTracker.cs
- ZipIOFileItemStream.cs
- SQLUtility.cs
- ManualResetEvent.cs
- AdornerPresentationContext.cs
- Effect.cs
- FixedSOMLineRanges.cs
- InfiniteTimeSpanConverter.cs
- Monitor.cs
- BuildProvidersCompiler.cs
- RequestContext.cs
- EntityContainerEntitySetDefiningQuery.cs
- Trace.cs
- DataObjectMethodAttribute.cs
- NameTable.cs
- XmlAnyElementAttributes.cs
- ManagedWndProcTracker.cs
- DataGridViewAddColumnDialog.cs
- LayoutInformation.cs
- ArrayWithOffset.cs
- ScriptingJsonSerializationSection.cs
- TypeConverterHelper.cs
- InheritanceAttribute.cs
- HiddenFieldPageStatePersister.cs
- SafeNativeMethodsCLR.cs
- Utils.cs
- Vector3D.cs
- XmlMtomWriter.cs
- XmlILTrace.cs
- MappingModelBuildProvider.cs
- RegistryKey.cs
- SamlSecurityTokenAuthenticator.cs
- FontUnit.cs
- CalendarDataBindingHandler.cs
- HtmlInputPassword.cs
- InstanceStore.cs
- DesignerLoader.cs
- ObjectHelper.cs
- HostVisual.cs
- BigInt.cs
- XmlReaderSettings.cs
- ExtensionSimplifierMarkupObject.cs
- TemplateColumn.cs
- CodeTypeDeclarationCollection.cs
- Int16Converter.cs
- MessageSecurityVersion.cs