Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- XmlName.cs
- MethodBuilder.cs
- TransformedBitmap.cs
- FrameworkContextData.cs
- InplaceBitmapMetadataWriter.cs
- BoolLiteral.cs
- LocalBuilder.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- Line.cs
- GridViewSelectEventArgs.cs
- StringExpressionSet.cs
- MetaModel.cs
- XmlNamespaceMapping.cs
- TextOutput.cs
- DynamicPropertyHolder.cs
- BitmapEffectGroup.cs
- X509ThumbprintKeyIdentifierClause.cs
- XmlIlGenerator.cs
- InfoCardHelper.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- EmptyStringExpandableObjectConverter.cs
- RecognizeCompletedEventArgs.cs
- ArrayList.cs
- Application.cs
- ActivatableWorkflowsQueryResult.cs
- TextEffectResolver.cs
- InternalUserCancelledException.cs
- CodeCatchClause.cs
- KoreanCalendar.cs
- EventSetter.cs
- ConnectionString.cs
- ObjectContext.cs
- XamlInt32CollectionSerializer.cs
- StreamResourceInfo.cs
- Run.cs
- GestureRecognizer.cs
- SqlDataSource.cs
- DateTimeConstantAttribute.cs
- CompoundFileIOPermission.cs
- DbException.cs
- EventHandlersStore.cs
- ViewEvent.cs
- Light.cs
- ListViewAutomationPeer.cs
- ConnectionManagementElementCollection.cs
- TdsParserHelperClasses.cs
- DateTimeOffset.cs
- GenericEnumerator.cs
- JsonDeserializer.cs
- UInt32.cs
- ZipIOCentralDirectoryBlock.cs
- ResourceContainer.cs
- EntityDesignerBuildProvider.cs
- NavigatingCancelEventArgs.cs
- MessageHeaderDescription.cs
- ClickablePoint.cs
- StringComparer.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- FileSystemEventArgs.cs
- HitTestResult.cs
- WorkflowRuntimeSection.cs
- KeyGestureValueSerializer.cs
- MSHTMLHostUtil.cs
- MasterPageBuildProvider.cs
- Confirm.cs
- RequestCache.cs
- SQLDouble.cs
- EmbeddedMailObject.cs
- NamespaceInfo.cs
- JsonEncodingStreamWrapper.cs
- AbstractSvcMapFileLoader.cs
- InputScopeConverter.cs
- FixedPosition.cs
- CodeVariableReferenceExpression.cs
- SmiMetaData.cs
- Transform3D.cs
- CodePropertyReferenceExpression.cs
- InputEventArgs.cs
- LedgerEntry.cs
- XamlTemplateSerializer.cs
- RenamedEventArgs.cs
- ImageListStreamer.cs
- AxHostDesigner.cs
- TextDpi.cs
- BitmapEffectGroup.cs
- ValidationErrorCollection.cs
- SqlFlattener.cs
- DrawingContextDrawingContextWalker.cs
- BitmapEffectInput.cs
- XmlSchemaCompilationSettings.cs
- IteratorFilter.cs
- CachedFontFamily.cs
- ItemDragEvent.cs
- MethodCallConverter.cs
- DataGridViewColumnConverter.cs
- SchemaImporterExtensionElement.cs
- NaturalLanguageHyphenator.cs
- FillBehavior.cs
- OrderByLifter.cs
- IntranetCredentialPolicy.cs