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
- VectorKeyFrameCollection.cs
- IDQuery.cs
- PassportPrincipal.cs
- PropertyIDSet.cs
- FixedSOMTableCell.cs
- DefaultTraceListener.cs
- ResourceExpressionBuilder.cs
- DataServices.cs
- ParameterElementCollection.cs
- xdrvalidator.cs
- RSAPKCS1SignatureFormatter.cs
- InputBuffer.cs
- SetterTriggerConditionValueConverter.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- Activity.cs
- Matrix3D.cs
- CompositeKey.cs
- ValueUnavailableException.cs
- InternalPermissions.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- InvokePatternIdentifiers.cs
- XamlSerializerUtil.cs
- Stack.cs
- DivideByZeroException.cs
- ConfigurationSchemaErrors.cs
- CommandValueSerializer.cs
- PatternMatcher.cs
- Point3DValueSerializer.cs
- SudsParser.cs
- Menu.cs
- RuleSettings.cs
- PeerCollaboration.cs
- WindowsGrip.cs
- PrinterResolution.cs
- DynamicAttribute.cs
- DragDropHelper.cs
- TemplatedMailWebEventProvider.cs
- CompoundFileStorageReference.cs
- XmlQueryContext.cs
- PageStatePersister.cs
- SQLDateTime.cs
- BitmapCodecInfo.cs
- XmlWrappingReader.cs
- TypeLoadException.cs
- SamlEvidence.cs
- Descriptor.cs
- DynamicResourceExtensionConverter.cs
- AsyncStreamReader.cs
- StringConcat.cs
- AuthenticationModulesSection.cs
- TableLayoutSettings.cs
- ServicePointManagerElement.cs
- ParserOptions.cs
- ProgressBarRenderer.cs
- KeyValueConfigurationCollection.cs
- ElementMarkupObject.cs
- SystemColors.cs
- GetResponse.cs
- GacUtil.cs
- _UriTypeConverter.cs
- ExpressionEditorAttribute.cs
- ListComponentEditorPage.cs
- WebConvert.cs
- DynamicDataExtensions.cs
- ChangeConflicts.cs
- ColorTransformHelper.cs
- DataGridHyperlinkColumn.cs
- PrtTicket_Public_Simple.cs
- EventLogConfiguration.cs
- HttpDictionary.cs
- ActivityTypeDesigner.xaml.cs
- StylusPlugInCollection.cs
- DefaultValueTypeConverter.cs
- CssStyleCollection.cs
- ProfileSection.cs
- CodeGenerator.cs
- IntSecurity.cs
- DropSource.cs
- StatusBar.cs
- Repeater.cs
- WebPartCancelEventArgs.cs
- TextEditorSpelling.cs
- TabControlCancelEvent.cs
- DoubleCollection.cs
- ConsoleKeyInfo.cs
- Button.cs
- DataGridViewCellMouseEventArgs.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- StringArrayConverter.cs
- SqlNotificationRequest.cs
- ProfileSection.cs
- RegexFCD.cs
- SoapIncludeAttribute.cs
- XamlGridLengthSerializer.cs
- SelfIssuedAuthProofToken.cs
- ClonableStack.cs
- DispatcherExceptionEventArgs.cs
- TryLoadRunnableWorkflowCommand.cs
- CredentialCache.cs
- Activator.cs