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
- ExpressionBuilderContext.cs
- DataGridViewLinkCell.cs
- MaterialCollection.cs
- StringDictionaryCodeDomSerializer.cs
- ParameterToken.cs
- FtpRequestCacheValidator.cs
- UriTemplateLiteralPathSegment.cs
- Unit.cs
- arabicshape.cs
- Point3DKeyFrameCollection.cs
- EventTrigger.cs
- ThrowHelper.cs
- ButtonChrome.cs
- BrowserCapabilitiesCodeGenerator.cs
- x509store.cs
- FormViewDeleteEventArgs.cs
- BeginEvent.cs
- UserControlDocumentDesigner.cs
- ResourceReferenceKeyNotFoundException.cs
- XmlConverter.cs
- ParallelTimeline.cs
- Material.cs
- PhysicalFontFamily.cs
- EventProxy.cs
- ControlValuePropertyAttribute.cs
- NamespaceEmitter.cs
- SponsorHelper.cs
- StrokeRenderer.cs
- ExceptionHandlerDesigner.cs
- Funcletizer.cs
- ComUdtElementCollection.cs
- FrameworkElementFactoryMarkupObject.cs
- SystemParameters.cs
- _TimerThread.cs
- HideDisabledControlAdapter.cs
- SelectionItemProviderWrapper.cs
- IdentitySection.cs
- RuntimeConfigLKG.cs
- FullTextBreakpoint.cs
- ScriptRegistrationManager.cs
- RotateTransform3D.cs
- FontWeights.cs
- FillBehavior.cs
- FontUnitConverter.cs
- XmlnsCache.cs
- ArcSegment.cs
- XmlMembersMapping.cs
- LogWriteRestartAreaAsyncResult.cs
- CryptoApi.cs
- ReferencedAssemblyResolver.cs
- ReturnType.cs
- WebConvert.cs
- DiscreteKeyFrames.cs
- SessionStateModule.cs
- XmlProcessingInstruction.cs
- ipaddressinformationcollection.cs
- RepeaterDataBoundAdapter.cs
- CharacterBuffer.cs
- Processor.cs
- Application.cs
- FrameworkName.cs
- ManipulationPivot.cs
- Substitution.cs
- AttributeEmitter.cs
- DataGridSortCommandEventArgs.cs
- SAPICategories.cs
- Boolean.cs
- QueryOutputWriterV1.cs
- WebPartConnectionCollection.cs
- StylusPointPropertyUnit.cs
- AdapterDictionary.cs
- Msec.cs
- SerializationStore.cs
- Int64Animation.cs
- EntityConnectionStringBuilder.cs
- MaskedTextBox.cs
- LicenseException.cs
- ToolboxSnapDragDropEventArgs.cs
- WebPartVerbCollection.cs
- PropertyAccessVisitor.cs
- EventProxy.cs
- HttpRequest.cs
- DbDataSourceEnumerator.cs
- versioninfo.cs
- FixedHighlight.cs
- ResourceDictionary.cs
- XmlValidatingReaderImpl.cs
- LineBreakRecord.cs
- CollectionBuilder.cs
- AnimationStorage.cs
- AsyncPostBackTrigger.cs
- ConsoleTraceListener.cs
- CommandField.cs
- SendMailErrorEventArgs.cs
- ChannelTraceRecord.cs
- ExceptionValidationRule.cs
- Span.cs
- CustomBindingElement.cs
- DiagnosticsConfigurationHandler.cs
- SynchronizationLockException.cs