Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ClassHandlersStore.cs
- Size.cs
- FontInfo.cs
- ProbeDuplex11AsyncResult.cs
- PropVariant.cs
- SharedPersonalizationStateInfo.cs
- StorageBasedPackageProperties.cs
- PermissionToken.cs
- ILGenerator.cs
- XmlDataLoader.cs
- WindowsListViewItemStartMenu.cs
- DiagnosticSection.cs
- ResourceType.cs
- ItemDragEvent.cs
- HostingPreferredMapPath.cs
- CopyNodeSetAction.cs
- ExtendedProperty.cs
- PeerCredentialElement.cs
- BindingsCollection.cs
- MessageQueue.cs
- DisplayNameAttribute.cs
- Wizard.cs
- DataGridViewColumnStateChangedEventArgs.cs
- MailSettingsSection.cs
- XmlEnumAttribute.cs
- FlowDocumentFormatter.cs
- PagedDataSource.cs
- XmlIterators.cs
- FixedPageStructure.cs
- RefreshEventArgs.cs
- EventSetter.cs
- VirtualPathProvider.cs
- VBCodeProvider.cs
- CompilationLock.cs
- designeractionbehavior.cs
- ManagementEventArgs.cs
- FileDataSource.cs
- CodeExpressionStatement.cs
- FormsAuthenticationEventArgs.cs
- WsatAdminException.cs
- MsmqPoisonMessageException.cs
- Console.cs
- SelectionRangeConverter.cs
- Socket.cs
- AsymmetricAlgorithm.cs
- SQLInt16.cs
- RawStylusInputReport.cs
- ForEach.cs
- Hyperlink.cs
- ToolStripDropDownMenu.cs
- SqlDependencyUtils.cs
- IISMapPath.cs
- Int64.cs
- Vector3DKeyFrameCollection.cs
- DataGridHeaderBorder.cs
- BackStopAuthenticationModule.cs
- TwoPhaseCommitProxy.cs
- HostedBindingBehavior.cs
- OpenTypeLayout.cs
- SafeViewOfFileHandle.cs
- SQLChars.cs
- GeneralTransform3D.cs
- OneWayElement.cs
- BaseValidator.cs
- DesignerActionItemCollection.cs
- Interlocked.cs
- VerificationException.cs
- InputLanguageProfileNotifySink.cs
- CompressEmulationStream.cs
- InternalResources.cs
- XmlSchemaAttributeGroup.cs
- DrawListViewSubItemEventArgs.cs
- HijriCalendar.cs
- DocumentSequenceHighlightLayer.cs
- CompiledQueryCacheEntry.cs
- ColorEditor.cs
- ProfileProvider.cs
- ConnectionManagementElementCollection.cs
- MessageDecoder.cs
- XmlText.cs
- XmlNamedNodeMap.cs
- TranslateTransform3D.cs
- TextEditorMouse.cs
- _ServiceNameStore.cs
- EnumUnknown.cs
- SmtpClient.cs
- PrimarySelectionGlyph.cs
- x509store.cs
- XmlSchemaInferenceException.cs
- BridgeDataReader.cs
- InitializerFacet.cs
- WindowsSolidBrush.cs
- Document.cs
- ObjectQuery.cs
- ObjectResult.cs
- Point3D.cs
- PersonalizationStateInfo.cs
- XComponentModel.cs
- WeakReferenceEnumerator.cs
- TableSectionStyle.cs