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
- ServiceHttpHandlerFactory.cs
- SafeProcessHandle.cs
- OdbcConnectionString.cs
- RandomDelaySendsAsyncResult.cs
- SharedRuntimeState.cs
- ValueProviderWrapper.cs
- COAUTHIDENTITY.cs
- MarkedHighlightComponent.cs
- UnmanagedMarshal.cs
- ToolboxCategory.cs
- MD5CryptoServiceProvider.cs
- _NestedSingleAsyncResult.cs
- FlagsAttribute.cs
- PriorityChain.cs
- PolyBezierSegment.cs
- LoadedEvent.cs
- ExceptionHandlerDesigner.cs
- TreeNodeStyleCollection.cs
- GraphicsContainer.cs
- Module.cs
- QueryParameter.cs
- SqlDataSourceCustomCommandPanel.cs
- ClientUrlResolverWrapper.cs
- Header.cs
- RetrieveVirtualItemEventArgs.cs
- PropertyGridEditorPart.cs
- WasEndpointConfigContainer.cs
- XmlObjectSerializerWriteContextComplex.cs
- FormsAuthentication.cs
- ResourcesChangeInfo.cs
- ToolStripRenderer.cs
- WmlFormAdapter.cs
- invalidudtexception.cs
- QueryAccessibilityHelpEvent.cs
- WmlImageAdapter.cs
- MembershipSection.cs
- HelpProvider.cs
- DataServiceProcessingPipelineEventArgs.cs
- NetSectionGroup.cs
- XmlDataImplementation.cs
- FloaterParagraph.cs
- FactoryMaker.cs
- SerializationInfo.cs
- Rotation3D.cs
- DecoderFallbackWithFailureFlag.cs
- Matrix3DConverter.cs
- ReceiveMessageRecord.cs
- InputReport.cs
- DeploymentSection.cs
- ClaimTypes.cs
- CheckBoxRenderer.cs
- ObjectQueryProvider.cs
- XmlSecureResolver.cs
- ScrollProperties.cs
- DataGridBeginningEditEventArgs.cs
- Activity.cs
- SoapEnvelopeProcessingElement.cs
- DispatcherProcessingDisabled.cs
- Brush.cs
- HtmlInputButton.cs
- IntegerCollectionEditor.cs
- DocumentXPathNavigator.cs
- remotingproxy.cs
- XamlFrame.cs
- TableLayoutSettings.cs
- Int32.cs
- IssuedTokenServiceCredential.cs
- HyperLink.cs
- BitmapEffectGroup.cs
- BindingBase.cs
- XmlTextAttribute.cs
- CodeDefaultValueExpression.cs
- Array.cs
- FontSizeConverter.cs
- DependencyPropertyKey.cs
- ClientTargetCollection.cs
- EnumBuilder.cs
- ContextTokenTypeConverter.cs
- StyleTypedPropertyAttribute.cs
- TrustLevelCollection.cs
- TextEffectCollection.cs
- BuildManagerHost.cs
- BitHelper.cs
- StdValidatorsAndConverters.cs
- DataColumnMapping.cs
- ModelFunction.cs
- InternalPermissions.cs
- Decorator.cs
- SpinLock.cs
- ObjectHelper.cs
- Nullable.cs
- TemplatedControlDesigner.cs
- SeekStoryboard.cs
- WebBrowserSiteBase.cs
- XpsFilter.cs
- TcpServerChannel.cs
- TypeRestriction.cs
- DurationConverter.cs
- basecomparevalidator.cs
- WebServicesDescriptionAttribute.cs