Code:
/ FX-1434 / FX-1434 / 1.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
- ChannelParameterCollection.cs
- TagPrefixAttribute.cs
- NullableIntSumAggregationOperator.cs
- CancelEventArgs.cs
- UInt32.cs
- CodeGeneratorOptions.cs
- SQLDateTimeStorage.cs
- ValidatorCollection.cs
- SqlProviderManifest.cs
- ExtenderProvidedPropertyAttribute.cs
- Interop.cs
- Grid.cs
- ToolboxItemFilterAttribute.cs
- CopyCodeAction.cs
- ClientFormsIdentity.cs
- SqlDataSourceCommandEventArgs.cs
- EdmMember.cs
- CacheModeConverter.cs
- SoapAttributeOverrides.cs
- NotImplementedException.cs
- WebColorConverter.cs
- COM2Properties.cs
- WebPartDescriptionCollection.cs
- ObjectResult.cs
- InkCollectionBehavior.cs
- GridItem.cs
- TextBox.cs
- safex509handles.cs
- HtmlInputSubmit.cs
- ToolStripItem.cs
- Activity.cs
- GeneralTransform3D.cs
- NotificationContext.cs
- PtsPage.cs
- WebContext.cs
- UInt32Converter.cs
- Activator.cs
- IIS7WorkerRequest.cs
- TemplateContentLoader.cs
- BindableTemplateBuilder.cs
- ImageCodecInfo.cs
- CommentEmitter.cs
- ToolStripSplitStackLayout.cs
- XmlSchemaSimpleType.cs
- Config.cs
- WebConfigurationHost.cs
- XmlWhitespace.cs
- CodeDirectiveCollection.cs
- StylusOverProperty.cs
- CompressionTransform.cs
- OleDbCommandBuilder.cs
- TypeElementCollection.cs
- Peer.cs
- MobileTextWriter.cs
- DataGridItemEventArgs.cs
- Constraint.cs
- ServicePointManagerElement.cs
- ExcCanonicalXml.cs
- TypeResolvingOptions.cs
- AsnEncodedData.cs
- ParagraphVisual.cs
- WsdlEndpointConversionContext.cs
- XNodeValidator.cs
- HitTestWithGeometryDrawingContextWalker.cs
- DateTimeFormatInfo.cs
- PageWrapper.cs
- SizeChangedEventArgs.cs
- TempEnvironment.cs
- CustomCredentialPolicy.cs
- PassportAuthentication.cs
- SiteMapPathDesigner.cs
- ThreadInterruptedException.cs
- PropertyGridEditorPart.cs
- ObjectPersistData.cs
- DataGridColumn.cs
- ThreadStateException.cs
- CompositeDataBoundControl.cs
- sqlnorm.cs
- SHA1CryptoServiceProvider.cs
- ImageMap.cs
- ListBoxItemAutomationPeer.cs
- NameNode.cs
- RouteData.cs
- BamlRecordWriter.cs
- PointCollection.cs
- ImmutableCollection.cs
- RandomNumberGenerator.cs
- OdbcConnectionHandle.cs
- SafePointer.cs
- ComplusTypeValidator.cs
- FormsAuthenticationTicket.cs
- WebBrowserEvent.cs
- DataGridViewIntLinkedList.cs
- InitializationEventAttribute.cs
- ValidatingPropertiesEventArgs.cs
- StateDesigner.TransitionInfo.cs
- GridViewPageEventArgs.cs
- OracleColumn.cs
- AsyncResult.cs
- Calendar.cs