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
- ChannelManager.cs
- StorageInfo.cs
- MasterPage.cs
- RowToParametersTransformer.cs
- TextRunCacheImp.cs
- Interlocked.cs
- FunctionQuery.cs
- SpellerError.cs
- DashStyle.cs
- SystemSounds.cs
- TdsParser.cs
- WebPartDisplayMode.cs
- DataGridViewComboBoxEditingControl.cs
- WizardPanel.cs
- HtmlImage.cs
- MissingManifestResourceException.cs
- ArgumentOutOfRangeException.cs
- ApplicationException.cs
- BamlWriter.cs
- RequestNavigateEventArgs.cs
- MorphHelpers.cs
- BrowserCapabilitiesCodeGenerator.cs
- XmlParser.cs
- WebContext.cs
- XmlSchemaAnyAttribute.cs
- SmtpMail.cs
- DataError.cs
- GenericsNotImplementedException.cs
- StorageEntitySetMapping.cs
- ETagAttribute.cs
- HttpRequestCacheValidator.cs
- LineServices.cs
- GridViewSelectEventArgs.cs
- HttpFileCollectionWrapper.cs
- LOSFormatter.cs
- ColorMap.cs
- InputLanguage.cs
- LineUtil.cs
- StructureChangedEventArgs.cs
- EndpointAddressElementBase.cs
- ExternalException.cs
- DiscoveryDocument.cs
- SchemaComplexType.cs
- DataGridViewColumnConverter.cs
- ProbeDuplexAsyncResult.cs
- DependencyPropertyKind.cs
- AdvancedBindingEditor.cs
- SqlAliasesReferenced.cs
- COM2PropertyDescriptor.cs
- SqlComparer.cs
- SafeCancelMibChangeNotify.cs
- InternalRelationshipCollection.cs
- ClipboardData.cs
- BaseAsyncResult.cs
- UserControlParser.cs
- TrackingMemoryStream.cs
- ProtocolsConfiguration.cs
- DesignerEventService.cs
- CommunicationException.cs
- ProviderUtil.cs
- XmlWriter.cs
- SoapReflectionImporter.cs
- NumberAction.cs
- SizeValueSerializer.cs
- DescendentsWalkerBase.cs
- FileCodeGroup.cs
- ProgramNode.cs
- UnitySerializationHolder.cs
- SafeCryptContextHandle.cs
- SettingsBase.cs
- _CommandStream.cs
- SerializationFieldInfo.cs
- TemplateBindingExtensionConverter.cs
- RectangleGeometry.cs
- CellConstantDomain.cs
- CTreeGenerator.cs
- SerializationAttributes.cs
- BooleanConverter.cs
- TextRunCacheImp.cs
- TextProviderWrapper.cs
- SamlDelegatingWriter.cs
- NavigatingCancelEventArgs.cs
- Emitter.cs
- SamlAuthorityBinding.cs
- PriorityRange.cs
- Int32Rect.cs
- RootProjectionNode.cs
- ComboBoxRenderer.cs
- ConfigurationManagerInternal.cs
- CriticalHandle.cs
- PrintPreviewGraphics.cs
- XmlStreamStore.cs
- PerfCounters.cs
- AnyReturnReader.cs
- entitydatasourceentitysetnameconverter.cs
- HtmlInputHidden.cs
- XmlAnyAttributeAttribute.cs
- XmlExtensionFunction.cs
- TailCallAnalyzer.cs
- DataGridRelationshipRow.cs