Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TypeUnloadedException.cs
- SQLMoney.cs
- RestHandlerFactory.cs
- TabletCollection.cs
- BufferedWebEventProvider.cs
- SeekStoryboard.cs
- PeerServiceMessageContracts.cs
- XmlDataSource.cs
- EntityViewGenerationAttribute.cs
- CustomAttributeSerializer.cs
- OdbcParameter.cs
- OLEDB_Util.cs
- RemotingServices.cs
- SqlIdentifier.cs
- RegularExpressionValidator.cs
- CounterSetInstanceCounterDataSet.cs
- AffineTransform3D.cs
- ProbeDuplexCD1AsyncResult.cs
- PageParserFilter.cs
- SmtpNegotiateAuthenticationModule.cs
- Addressing.cs
- Int64.cs
- BCLDebug.cs
- DefaultCommandExtensionCallback.cs
- StrongNameUtility.cs
- IProducerConsumerCollection.cs
- MetadataCacheItem.cs
- ObjectConverter.cs
- Math.cs
- Byte.cs
- SqlProcedureAttribute.cs
- SQLUtility.cs
- SynchronizingStream.cs
- ScrollChrome.cs
- UniqueEventHelper.cs
- SecurityDescriptor.cs
- TextBlockAutomationPeer.cs
- WebPartConnection.cs
- FloaterParagraph.cs
- X509Utils.cs
- ByeOperationCD1AsyncResult.cs
- TextWriterTraceListener.cs
- ApplicationTrust.cs
- JulianCalendar.cs
- DoubleAnimationUsingKeyFrames.cs
- peersecurityelement.cs
- TaiwanLunisolarCalendar.cs
- Int64KeyFrameCollection.cs
- MailWriter.cs
- WorkerRequest.cs
- SQLRoleProvider.cs
- HttpCapabilitiesEvaluator.cs
- XmlSchemaFacet.cs
- Transform3DCollection.cs
- HttpPostProtocolImporter.cs
- Predicate.cs
- OleDbConnectionFactory.cs
- XmlQuerySequence.cs
- ValueChangedEventManager.cs
- ColorInterpolationModeValidation.cs
- LowerCaseStringConverter.cs
- LayoutInformation.cs
- TraceSection.cs
- SerializerDescriptor.cs
- __ConsoleStream.cs
- GrammarBuilderPhrase.cs
- ModelUIElement3D.cs
- CallbackValidator.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- RandomNumberGenerator.cs
- VersionedStream.cs
- StickyNoteHelper.cs
- HwndHostAutomationPeer.cs
- AttributeParameterInfo.cs
- CollectionExtensions.cs
- ValueQuery.cs
- BufferedReadStream.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- autovalidator.cs
- COM2IProvidePropertyBuilderHandler.cs
- TabPanel.cs
- SqlColumnizer.cs
- AlignmentYValidation.cs
- SystemSounds.cs
- SBCSCodePageEncoding.cs
- ExtractedStateEntry.cs
- XmlToDatasetMap.cs
- RepeaterItem.cs
- ChannelServices.cs
- DataComponentMethodGenerator.cs
- VariableQuery.cs
- ConfigurationElementCollection.cs
- StackSpiller.cs
- ModifierKeysConverter.cs
- CacheRequest.cs
- DelegateSerializationHolder.cs
- WebPermission.cs
- RawContentTypeMapper.cs
- WebPartMinimizeVerb.cs
- MaskedTextProvider.cs