Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// 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 } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextBoxBase.cs
- URIFormatException.cs
- MemberBinding.cs
- AttributeParameterInfo.cs
- AdRotator.cs
- InstanceKeyCollisionException.cs
- WmfPlaceableFileHeader.cs
- DataGridViewRowEventArgs.cs
- ZipFileInfoCollection.cs
- ResourceExpressionBuilder.cs
- RemotingConfiguration.cs
- VersionPair.cs
- ClonableStack.cs
- EventDescriptor.cs
- ValidationError.cs
- DragCompletedEventArgs.cs
- XmlWriter.cs
- ErrorStyle.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- BitmapEffectInput.cs
- _Rfc2616CacheValidators.cs
- DecimalAnimation.cs
- SQLDecimalStorage.cs
- User.cs
- XmlDataFileEditor.cs
- SemanticTag.cs
- PeerEndPoint.cs
- UriSectionReader.cs
- TreeNode.cs
- Bits.cs
- WebPartEditorApplyVerb.cs
- AuthenticationConfig.cs
- Int32CollectionValueSerializer.cs
- ConnectionPool.cs
- InfiniteTimeSpanConverter.cs
- SQLResource.cs
- StreamGeometryContext.cs
- ObjectSecurity.cs
- XomlDesignerLoader.cs
- QueryRewriter.cs
- StagingAreaInputItem.cs
- DataGridSortCommandEventArgs.cs
- CorrelationTokenInvalidatedHandler.cs
- XmlILStorageConverter.cs
- WindowsStartMenu.cs
- VsPropertyGrid.cs
- DataAdapter.cs
- StorageRoot.cs
- ObjectDataSourceStatusEventArgs.cs
- UnsafeNativeMethods.cs
- NoResizeSelectionBorderGlyph.cs
- Listen.cs
- SafeNativeMethodsOther.cs
- BinaryNode.cs
- TableLayoutColumnStyleCollection.cs
- XPathMultyIterator.cs
- StorageAssociationTypeMapping.cs
- ClipboardProcessor.cs
- SafeProcessHandle.cs
- ReflectTypeDescriptionProvider.cs
- ProfileInfo.cs
- ApplicationGesture.cs
- CompilerErrorCollection.cs
- TdsParserHelperClasses.cs
- HostingPreferredMapPath.cs
- PassportAuthenticationModule.cs
- httpserverutility.cs
- ButtonBase.cs
- AudioException.cs
- SmtpSection.cs
- DeflateEmulationStream.cs
- TextModifier.cs
- PartialCachingControl.cs
- FolderNameEditor.cs
- PaperSize.cs
- SqlUtils.cs
- WinFormsComponentEditor.cs
- __Filters.cs
- SmtpAuthenticationManager.cs
- SqlDataSourceFilteringEventArgs.cs
- WebRequest.cs
- ComboBoxAutomationPeer.cs
- ProcessInputEventArgs.cs
- CatalogPartCollection.cs
- Win32SafeHandles.cs
- CompModSwitches.cs
- AuthorizationSection.cs
- ImageFormatConverter.cs
- PasswordPropertyTextAttribute.cs
- TargetParameterCountException.cs
- CharKeyFrameCollection.cs
- ComboBoxAutomationPeer.cs
- Function.cs
- ResourceBinder.cs
- SynchronizationLockException.cs
- InlineCategoriesDocument.cs
- RandomNumberGenerator.cs
- TdsParameterSetter.cs
- ObjectAnimationUsingKeyFrames.cs
- ReadOnlyDictionary.cs