Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyHierarchicalDataSource.cs / 1305376 / 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
- TdsParser.cs
- EntityTypeEmitter.cs
- TypeUnloadedException.cs
- OpenTypeLayoutCache.cs
- _SpnDictionary.cs
- SecurityProtocolCorrelationState.cs
- PublisherIdentityPermission.cs
- XmlAtomicValue.cs
- CalendarDateChangedEventArgs.cs
- BindingCompleteEventArgs.cs
- AttributeCollection.cs
- AssemblyNameProxy.cs
- DBSchemaRow.cs
- DoWorkEventArgs.cs
- TextElementAutomationPeer.cs
- SpellCheck.cs
- Qualifier.cs
- RSAPKCS1SignatureDeformatter.cs
- Application.cs
- XmlBaseWriter.cs
- CompositeFontInfo.cs
- BaseValidator.cs
- EventLogger.cs
- DataBindingList.cs
- ProfileGroupSettings.cs
- ConfigurationFileMap.cs
- HTMLTextWriter.cs
- TranslateTransform3D.cs
- XmlDocumentType.cs
- XamlTemplateSerializer.cs
- HopperCache.cs
- EntityUtil.cs
- Vertex.cs
- TypePropertyEditor.cs
- UnmanagedHandle.cs
- WmlCommandAdapter.cs
- CompositeFontParser.cs
- Stylus.cs
- SHA384Managed.cs
- PTConverter.cs
- EdmItemCollection.OcAssemblyCache.cs
- X509AsymmetricSecurityKey.cs
- PaintValueEventArgs.cs
- DataGridViewBand.cs
- NumberSubstitution.cs
- DataControlFieldsEditor.cs
- LinqDataSourceDisposeEventArgs.cs
- ComboBoxDesigner.cs
- KeyProperty.cs
- FloatUtil.cs
- WindowsTitleBar.cs
- NullableBoolConverter.cs
- SqlExpander.cs
- XamlSerializerUtil.cs
- DragSelectionMessageFilter.cs
- FacetEnabledSchemaElement.cs
- DataSourceListEditor.cs
- HScrollProperties.cs
- DataServiceQueryException.cs
- BitmapEffect.cs
- TrackingMemoryStreamFactory.cs
- SinglePageViewer.cs
- DataGridViewColumnEventArgs.cs
- MetadataPropertyCollection.cs
- TypeBuilderInstantiation.cs
- SafeSerializationManager.cs
- Dictionary.cs
- FileLevelControlBuilderAttribute.cs
- SendMailErrorEventArgs.cs
- XmlSchemaSet.cs
- MessageFilter.cs
- SqlInternalConnection.cs
- WebSysDefaultValueAttribute.cs
- ObjectView.cs
- ManagementObjectSearcher.cs
- ProcessingInstructionAction.cs
- ColorMap.cs
- FrameworkObject.cs
- _NtlmClient.cs
- ServiceHttpModule.cs
- __TransparentProxy.cs
- SafeMemoryMappedViewHandle.cs
- XmlEnumAttribute.cs
- ExcludePathInfo.cs
- PathSegmentCollection.cs
- BezierSegment.cs
- WinFormsSpinner.cs
- TabControl.cs
- NamespaceInfo.cs
- BinaryKeyIdentifierClause.cs
- DuplicateWaitObjectException.cs
- PropertyChangingEventArgs.cs
- CapiNative.cs
- InstanceView.cs
- DataListItemEventArgs.cs
- Operand.cs
- TraceLog.cs
- AssemblyHash.cs
- ActiveXContainer.cs
- GorillaCodec.cs