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
- ParserHooks.cs
- TransformGroup.cs
- MessageSmuggler.cs
- Formatter.cs
- ExceptionHelpers.cs
- WebPartDescriptionCollection.cs
- ToolBar.cs
- TransportSecurityHelpers.cs
- EntityDataSourceWrapper.cs
- GlobalEventManager.cs
- HandlerFactoryCache.cs
- RSAPKCS1SignatureDeformatter.cs
- BuildProviderUtils.cs
- WindowsFormsEditorServiceHelper.cs
- Lookup.cs
- MaskDesignerDialog.cs
- RootProfilePropertySettingsCollection.cs
- HttpChannelBindingToken.cs
- PointKeyFrameCollection.cs
- PropertyManager.cs
- UsernameTokenFactoryCredential.cs
- InstanceCreationEditor.cs
- _SSPISessionCache.cs
- basemetadatamappingvisitor.cs
- AdRotator.cs
- RequestTimeoutManager.cs
- RbTree.cs
- PrintEvent.cs
- ToolStripDropTargetManager.cs
- GregorianCalendarHelper.cs
- SafeLibraryHandle.cs
- ProtocolElementCollection.cs
- QualificationDataItem.cs
- ConnectionPoint.cs
- ChtmlTextWriter.cs
- AccessDataSourceDesigner.cs
- QueryCoreOp.cs
- Config.cs
- AdornedElementPlaceholder.cs
- StringUtil.cs
- DelegatedStream.cs
- PageEventArgs.cs
- StackSpiller.cs
- ToolBarPanel.cs
- StrokeFIndices.cs
- DataSourceSelectArguments.cs
- Geometry3D.cs
- TypefaceMetricsCache.cs
- TableStyle.cs
- BaseInfoTable.cs
- AsyncDataRequest.cs
- WebContext.cs
- ServiceModelSecurityTokenTypes.cs
- TrackingProfileDeserializationException.cs
- SmtpFailedRecipientsException.cs
- TrustManagerPromptUI.cs
- ExpressionBuilder.cs
- ObjectRef.cs
- SimpleBitVector32.cs
- FixedSOMSemanticBox.cs
- CodeLabeledStatement.cs
- DerivedKeySecurityTokenStub.cs
- CalendarAutoFormatDialog.cs
- SettingsAttributes.cs
- CodeStatement.cs
- RegularExpressionValidator.cs
- ExpressionBuilder.cs
- ScriptResourceHandler.cs
- InputMethodStateTypeInfo.cs
- EmptyEnumerator.cs
- DecoderExceptionFallback.cs
- ListViewAutomationPeer.cs
- ExceptionHandlers.cs
- SizeAnimationBase.cs
- WebPartCancelEventArgs.cs
- MonthChangedEventArgs.cs
- Missing.cs
- TextSelectionHighlightLayer.cs
- DataGridLinkButton.cs
- RemotingConfigParser.cs
- EasingQuaternionKeyFrame.cs
- ChannelServices.cs
- SpellerInterop.cs
- RequestStatusBarUpdateEventArgs.cs
- Transform3DGroup.cs
- JavaScriptString.cs
- TdsParameterSetter.cs
- HtmlTableCell.cs
- RuleSettings.cs
- LongTypeConverter.cs
- StatusBarDrawItemEvent.cs
- DrawingGroup.cs
- HttpFileCollection.cs
- Rfc2898DeriveBytes.cs
- _NestedMultipleAsyncResult.cs
- Stacktrace.cs
- FileDialog.cs
- WhitespaceSignificantCollectionAttribute.cs
- GridViewCellAutomationPeer.cs
- PictureBox.cs