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
- BatchServiceHost.cs
- DateTimeOffset.cs
- LookupNode.cs
- Root.cs
- AutoFocusStyle.xaml.cs
- StringConverter.cs
- HtmlInputControl.cs
- ArgumentValueSerializer.cs
- SQLCharsStorage.cs
- WebPermission.cs
- ExpressionList.cs
- TransportSecurityProtocol.cs
- RuntimeConfigurationRecord.cs
- CroppedBitmap.cs
- ExtentKey.cs
- Drawing.cs
- DrawTreeNodeEventArgs.cs
- TcpProcessProtocolHandler.cs
- ContractMapping.cs
- DefaultShape.cs
- KeyedCollection.cs
- RuleInfoComparer.cs
- WsatServiceAddress.cs
- BrowserCapabilitiesFactory.cs
- InteropAutomationProvider.cs
- EventPrivateKey.cs
- SmtpSection.cs
- StackOverflowException.cs
- QilLoop.cs
- RecognizerBase.cs
- DesignerActionUI.cs
- UrlParameterReader.cs
- BitmapCodecInfo.cs
- Matrix.cs
- RolePrincipal.cs
- MdiWindowListStrip.cs
- peersecurityelement.cs
- LinqDataSourceInsertEventArgs.cs
- XmlStreamStore.cs
- PerformanceCounterPermission.cs
- EtwTrace.cs
- CustomErrorsSectionWrapper.cs
- SafeFileMappingHandle.cs
- DelimitedListTraceListener.cs
- SerialPinChanges.cs
- WhitespaceRuleLookup.cs
- ReadWriteObjectLock.cs
- DataTableCollection.cs
- IChannel.cs
- FaultPropagationRecord.cs
- KeySpline.cs
- DependencyPropertyAttribute.cs
- DesignerInterfaces.cs
- Size.cs
- SiblingIterators.cs
- _SpnDictionary.cs
- ChannelDispatcherCollection.cs
- PropertyMetadata.cs
- EventDescriptor.cs
- DependencyStoreSurrogate.cs
- RoutedEventArgs.cs
- HtmlDocument.cs
- CompoundFileStreamReference.cs
- OdbcConnection.cs
- NativeMethodsCLR.cs
- Convert.cs
- Interlocked.cs
- IndexedEnumerable.cs
- MsdtcWrapper.cs
- UserControlAutomationPeer.cs
- WebConvert.cs
- Errors.cs
- SrgsOneOf.cs
- StreamedWorkflowDefinitionContext.cs
- QilGenerator.cs
- CancellationTokenSource.cs
- DiagnosticTrace.cs
- RepeaterCommandEventArgs.cs
- RoleServiceManager.cs
- SspiSecurityTokenProvider.cs
- LocalizationComments.cs
- DataExpression.cs
- SqlRewriteScalarSubqueries.cs
- PropertyOverridesTypeEditor.cs
- ProcessHostMapPath.cs
- UpdatePanel.cs
- SqlCrossApplyToCrossJoin.cs
- BamlLocalizationDictionary.cs
- WebBrowserEvent.cs
- FileController.cs
- RefreshPropertiesAttribute.cs
- XmlSchemaInferenceException.cs
- UnionCodeGroup.cs
- StaticExtension.cs
- OptimisticConcurrencyException.cs
- XmlAnyElementAttributes.cs
- DataGridViewCellCancelEventArgs.cs
- ListMarkerSourceInfo.cs
- UidPropertyAttribute.cs
- FromRequest.cs