Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyDataSource.cs / 1 / ReadOnlyDataSource.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 data bound controls to wrap an generic data source /// with a strongly typed IDataSource. This class automatically handles /// other IDataSources, IEnumerable, and IListSource objects. /// This class uses ReadOnlyDataSourceView to represent individual views. /// internal sealed class ReadOnlyDataSource : IDataSource { private static string[] ViewNames = new string[0]; private string _dataMember; private object _dataSource; public ReadOnlyDataSource(object dataSource, string dataMember) { Debug.Assert(dataSource == null || (dataSource is IEnumerable || dataSource is IDataSource || dataSource is IListSource), "Expected dataSource to be either null, an IEnumerable, an IDataSource, or an IListSource."); _dataSource = dataSource; _dataMember = dataMember; } #region Implementation of IDataSource event EventHandler IDataSource.DataSourceChanged { add { } remove { } } ////// Check for IDataSource, IListSource, and IEnumerable, and return an /// approprite DataSourceView. /// DataSourceView IDataSource.GetView(string viewName) { // Check first for IDataSource IDataSource ds = _dataSource as IDataSource; if (ds != null) { return ds.GetView(viewName); } IEnumerable enumerable = DataSourceHelper.GetResolvedDataSource(_dataSource, _dataMember); return new ReadOnlyDataSourceView(this, _dataMember, enumerable); } ICollection IDataSource.GetViewNames() { return ViewNames; } #endregion } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EmptyEnumerator.cs
- SafeRightsManagementQueryHandle.cs
- CodeBlockBuilder.cs
- Helpers.cs
- ObjectDataSourceDisposingEventArgs.cs
- ReceiveMessageContent.cs
- CaseInsensitiveComparer.cs
- AsymmetricKeyExchangeDeformatter.cs
- VectorAnimation.cs
- Gdiplus.cs
- TextSerializer.cs
- CrossSiteScriptingValidation.cs
- OutputCacheModule.cs
- RequestBringIntoViewEventArgs.cs
- TimeSpanParse.cs
- DataSourceCache.cs
- CqlBlock.cs
- Thumb.cs
- LocalBuilder.cs
- Typeface.cs
- XmlSchemaComplexType.cs
- SqlProfileProvider.cs
- DataServiceRequestOfT.cs
- StylusPlugInCollection.cs
- SqlCommandBuilder.cs
- PeerContact.cs
- SplitContainer.cs
- IncrementalCompileAnalyzer.cs
- DispatchWrapper.cs
- ExpandCollapsePattern.cs
- TouchesOverProperty.cs
- DataColumnMapping.cs
- TransformerInfoCollection.cs
- TextRunProperties.cs
- ToolboxCategory.cs
- OracleConnectionStringBuilder.cs
- QilFactory.cs
- LeafCellTreeNode.cs
- TracedNativeMethods.cs
- JsonReaderDelegator.cs
- DatagridviewDisplayedBandsData.cs
- ImmComposition.cs
- smtppermission.cs
- Collection.cs
- TemplateApplicationHelper.cs
- OrderablePartitioner.cs
- X509Extension.cs
- FileDialogCustomPlacesCollection.cs
- CalendarAutomationPeer.cs
- TraceContextEventArgs.cs
- BinarySerializer.cs
- BaseTemplateCodeDomTreeGenerator.cs
- XPathDocumentIterator.cs
- HttpTransportSecurity.cs
- ClientConfigPaths.cs
- selecteditemcollection.cs
- CustomErrorsSection.cs
- SiteMapSection.cs
- FloaterBaseParaClient.cs
- SrgsRuleRef.cs
- DbProviderSpecificTypePropertyAttribute.cs
- OracleTimeSpan.cs
- DropDownList.cs
- DependencyPropertyHelper.cs
- CodeDesigner.cs
- BulletChrome.cs
- RuleElement.cs
- TextDecorationCollection.cs
- AutomationTextAttribute.cs
- Classification.cs
- MetadataItemCollectionFactory.cs
- ExceptionUtil.cs
- Multiply.cs
- CustomAttributeFormatException.cs
- ConditionalAttribute.cs
- DataGridViewToolTip.cs
- DataServiceSaveChangesEventArgs.cs
- COM2ComponentEditor.cs
- AnnotationResource.cs
- EUCJPEncoding.cs
- Stroke.cs
- SecurityTokenProvider.cs
- XmlSchemaType.cs
- NativeMethods.cs
- ButtonBaseAdapter.cs
- RenderCapability.cs
- MarkedHighlightComponent.cs
- WebBrowserDocumentCompletedEventHandler.cs
- RequestCacheValidator.cs
- TickBar.cs
- ToolStripPanelRenderEventArgs.cs
- PersonalizationProvider.cs
- FormsAuthentication.cs
- OdbcDataReader.cs
- RowParagraph.cs
- VariableElement.cs
- ScalarOps.cs
- HostedTcpTransportManager.cs
- Serializer.cs
- CustomDictionarySources.cs