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
- FlowDocumentReader.cs
- ProxyWebPart.cs
- ConstantProjectedSlot.cs
- ActivityLocationReferenceEnvironment.cs
- ProxyGenerator.cs
- ListBoxAutomationPeer.cs
- ProfileGroupSettingsCollection.cs
- Keywords.cs
- TagPrefixAttribute.cs
- StateMachine.cs
- StringDictionary.cs
- COM2TypeInfoProcessor.cs
- Propagator.cs
- DataGridLinkButton.cs
- VirtualizingStackPanel.cs
- ProviderUtil.cs
- SmiXetterAccessMap.cs
- OleDbReferenceCollection.cs
- Int64AnimationBase.cs
- Button.cs
- AndCondition.cs
- XmlILAnnotation.cs
- EventToken.cs
- RadialGradientBrush.cs
- HtmlFormWrapper.cs
- LambdaValue.cs
- DefaultProxySection.cs
- QilFunction.cs
- PathGradientBrush.cs
- _FtpDataStream.cs
- SamlAttributeStatement.cs
- CookieParameter.cs
- WpfKnownMemberInvoker.cs
- Stream.cs
- RuleSetDialog.Designer.cs
- BasicExpressionVisitor.cs
- NullableDoubleSumAggregationOperator.cs
- IteratorAsyncResult.cs
- NonParentingControl.cs
- PropertyRecord.cs
- XamlClipboardData.cs
- RolePrincipal.cs
- Int16Converter.cs
- NextPreviousPagerField.cs
- CacheModeValueSerializer.cs
- KeysConverter.cs
- CallContext.cs
- TypeExtension.cs
- CodeTypeReferenceCollection.cs
- DetailsViewPagerRow.cs
- EntityDataSourceQueryBuilder.cs
- OrderingInfo.cs
- FormatConvertedBitmap.cs
- GraphicsState.cs
- CellRelation.cs
- StylusEventArgs.cs
- HtmlInputButton.cs
- Application.cs
- XMLSyntaxException.cs
- GC.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- RTLAwareMessageBox.cs
- DependencyObject.cs
- safesecurityhelperavalon.cs
- DmlSqlGenerator.cs
- OleDbDataReader.cs
- WorkflowQueue.cs
- XmlDomTextWriter.cs
- XPathAxisIterator.cs
- DataGridViewTextBoxColumn.cs
- PersistenceTypeAttribute.cs
- BamlLocalizationDictionary.cs
- WebUtil.cs
- WmlControlAdapter.cs
- WebServicesDescriptionAttribute.cs
- FontInfo.cs
- TripleDES.cs
- SocketManager.cs
- XPathSelfQuery.cs
- ViewDesigner.cs
- ProtocolsSection.cs
- PointCollection.cs
- InProcStateClientManager.cs
- ElementAction.cs
- CompiledQuery.cs
- CompareInfo.cs
- Merger.cs
- ErrorWebPart.cs
- XmlSchemaSimpleContent.cs
- PropagatorResult.cs
- _ConnectStream.cs
- VectorConverter.cs
- ProcessInfo.cs
- MetadataSource.cs
- ConfigXmlAttribute.cs
- IsolatedStorageFile.cs
- ApplicationCommands.cs
- DbInsertCommandTree.cs
- MetabaseSettings.cs
- ThreadStartException.cs