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
- SafeSecurityHandles.cs
- SqlCachedBuffer.cs
- ListenerBinder.cs
- SessionPageStatePersister.cs
- XmlSchemaDocumentation.cs
- NameTable.cs
- MenuAutomationPeer.cs
- SqlUdtInfo.cs
- ToolStripPanelSelectionGlyph.cs
- ConfigXmlCDataSection.cs
- ClientRolePrincipal.cs
- Bidi.cs
- EventSourceCreationData.cs
- ArraySubsetEnumerator.cs
- MonthChangedEventArgs.cs
- DelimitedListTraceListener.cs
- TcpClientChannel.cs
- GPPOINTF.cs
- ProgressChangedEventArgs.cs
- ConfigXmlText.cs
- HtmlElementCollection.cs
- GenerateTemporaryTargetAssembly.cs
- _Connection.cs
- TextTreeObjectNode.cs
- ErrorWrapper.cs
- WorkflowInstanceTerminatedRecord.cs
- PersonalizationStateInfoCollection.cs
- SqlDataSourceTableQuery.cs
- FormCollection.cs
- DataControlButton.cs
- MemberPath.cs
- EventHandlersStore.cs
- ReflectEventDescriptor.cs
- PlatformNotSupportedException.cs
- StatusBarItem.cs
- RealProxy.cs
- ServiceChannel.cs
- DbMetaDataColumnNames.cs
- XmlNavigatorStack.cs
- ParentQuery.cs
- BulletedListEventArgs.cs
- FormsAuthenticationModule.cs
- ImageSource.cs
- PagesSection.cs
- LocalizableAttribute.cs
- SettingsAttributes.cs
- PartialArray.cs
- DES.cs
- GridViewCommandEventArgs.cs
- BuildProviderAppliesToAttribute.cs
- ComponentGlyph.cs
- Calendar.cs
- RSAPKCS1SignatureFormatter.cs
- X509PeerCertificateAuthenticationElement.cs
- InputDevice.cs
- SQLDecimalStorage.cs
- GridViewSortEventArgs.cs
- KeyFrames.cs
- XhtmlBasicCommandAdapter.cs
- StateMachineWorkflowInstance.cs
- AttributeQuery.cs
- XmlSchemaDatatype.cs
- XmlSchema.cs
- SettingsPropertyWrongTypeException.cs
- MarkupProperty.cs
- EventRouteFactory.cs
- ListenerElementsCollection.cs
- CapabilitiesPattern.cs
- ColumnMapVisitor.cs
- AttributeQuery.cs
- Nullable.cs
- NativeCompoundFileAPIs.cs
- XsdDuration.cs
- ProcessThreadCollection.cs
- FixedSOMPage.cs
- FixedSOMTextRun.cs
- Point4D.cs
- JoinElimination.cs
- RenderData.cs
- SamlEvidence.cs
- JsonCollectionDataContract.cs
- TextRunProperties.cs
- DataSourceSelectArguments.cs
- ProcessModelInfo.cs
- NameValueCollection.cs
- ByteRangeDownloader.cs
- ProviderManager.cs
- Schema.cs
- InheritanceContextChangedEventManager.cs
- ApplicationId.cs
- WhitespaceRule.cs
- FigureHelper.cs
- XmlException.cs
- TransformGroup.cs
- WebMessageEncodingBindingElement.cs
- ProfileGroupSettingsCollection.cs
- RepeaterItemEventArgs.cs
- StrongNameIdentityPermission.cs
- DispatcherExceptionEventArgs.cs
- PixelShader.cs