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
- EventTrigger.cs
- controlskin.cs
- WebPartCloseVerb.cs
- SqlCommand.cs
- JpegBitmapEncoder.cs
- RemoteCryptoSignHashRequest.cs
- NGCSerializationManagerAsync.cs
- CompilerGlobalScopeAttribute.cs
- RoutedPropertyChangedEventArgs.cs
- DataObject.cs
- BoolExpressionVisitors.cs
- Model3D.cs
- TaskHelper.cs
- PrincipalPermissionMode.cs
- HtmlInputSubmit.cs
- DataGridViewCellStyleConverter.cs
- BevelBitmapEffect.cs
- TextWriter.cs
- DPAPIProtectedConfigurationProvider.cs
- DoubleCollectionValueSerializer.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- PrintDialog.cs
- SchemaEntity.cs
- ItemCheckedEvent.cs
- MetadataArtifactLoader.cs
- AbstractSvcMapFileLoader.cs
- ThreadStateException.cs
- ValidatorUtils.cs
- ParseNumbers.cs
- OutputBuffer.cs
- BamlResourceSerializer.cs
- Int64Storage.cs
- InvalidOleVariantTypeException.cs
- DataListItemCollection.cs
- _Connection.cs
- streamingZipPartStream.cs
- NavigationWindow.cs
- TcpChannelFactory.cs
- DesignerSerializerAttribute.cs
- GridErrorDlg.cs
- GAC.cs
- ToolStripLocationCancelEventArgs.cs
- GlobalItem.cs
- Pen.cs
- StateManagedCollection.cs
- BitmapFrameDecode.cs
- WebMessageEncodingBindingElement.cs
- PropertyDescriptor.cs
- CqlBlock.cs
- XamlToRtfParser.cs
- XslTransform.cs
- XamlFigureLengthSerializer.cs
- InvalidProgramException.cs
- MarkupCompilePass1.cs
- SystemIdentity.cs
- recordstatefactory.cs
- CharacterString.cs
- CurrencyWrapper.cs
- DataRelationPropertyDescriptor.cs
- InputBindingCollection.cs
- ApplicationDirectoryMembershipCondition.cs
- CustomAttributeFormatException.cs
- ResourceContainer.cs
- GenerateTemporaryTargetAssembly.cs
- SudsParser.cs
- XmlSchemas.cs
- XmlIncludeAttribute.cs
- TouchesOverProperty.cs
- DataGridViewCell.cs
- XmlUrlResolver.cs
- FloaterBaseParaClient.cs
- IHttpResponseInternal.cs
- ParentQuery.cs
- XmlReflectionImporter.cs
- UnlockInstanceAsyncResult.cs
- Deserializer.cs
- StoryFragments.cs
- EventMetadata.cs
- Header.cs
- mansign.cs
- PeerName.cs
- CustomPopupPlacement.cs
- BuildResultCache.cs
- KeyInstance.cs
- RandomNumberGenerator.cs
- RuleSettingsCollection.cs
- CatalogPartCollection.cs
- CheckedListBox.cs
- HttpModulesSection.cs
- SecUtil.cs
- ResourcesGenerator.cs
- XhtmlBasicImageAdapter.cs
- ComEventsInfo.cs
- XmlSchemaComplexType.cs
- HierarchicalDataSourceIDConverter.cs
- PersonalizationStateQuery.cs
- HtmlSelect.cs
- PrefixQName.cs
- ProxyManager.cs
- DescendantOverDescendantQuery.cs