Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IsolatedStorageFileStream.cs
- WmlPageAdapter.cs
- Keywords.cs
- SynchronizationContext.cs
- TraceUtility.cs
- ClassHandlersStore.cs
- TreeView.cs
- SqlStream.cs
- PolicyManager.cs
- CollectionCodeDomSerializer.cs
- SuppressMergeCheckAttribute.cs
- GrammarBuilder.cs
- ExpandedWrapper.cs
- EntityConnection.cs
- DependencyPropertyValueSerializer.cs
- TypeElement.cs
- ExpressionBuilderCollection.cs
- StringCollection.cs
- XmlCharacterData.cs
- EditorAttribute.cs
- InputManager.cs
- RectKeyFrameCollection.cs
- BitHelper.cs
- DrawingImage.cs
- TextEditorMouse.cs
- ValueUtilsSmi.cs
- TraceUtility.cs
- SystemFonts.cs
- BinarySecretSecurityToken.cs
- MemberListBinding.cs
- HtmlInputRadioButton.cs
- WeakEventTable.cs
- WinCategoryAttribute.cs
- JapaneseLunisolarCalendar.cs
- SelectionRangeConverter.cs
- CFGGrammar.cs
- SafeHandles.cs
- FixedPage.cs
- X509ClientCertificateAuthentication.cs
- DropTarget.cs
- Stack.cs
- dataobject.cs
- MarkerProperties.cs
- GeneratedCodeAttribute.cs
- ReflectEventDescriptor.cs
- ContextMenuService.cs
- EntityCommandExecutionException.cs
- MasterPageBuildProvider.cs
- CodeTypeOfExpression.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- CodeNamespace.cs
- FontWeight.cs
- ZipIOExtraFieldElement.cs
- SynchronizedRandom.cs
- WebEventTraceProvider.cs
- InputReferenceExpression.cs
- QueryOutputWriter.cs
- AmbientValueAttribute.cs
- MetadataSerializer.cs
- LinqDataSourceValidationException.cs
- DataGridColumn.cs
- ToolStripContentPanel.cs
- TextPattern.cs
- QilPatternFactory.cs
- StatusBarAutomationPeer.cs
- MessageQueueKey.cs
- DataObjectAttribute.cs
- ConvertBinder.cs
- Canvas.cs
- CodeTypeParameter.cs
- WinEventHandler.cs
- RestHandler.cs
- AppDomainProtocolHandler.cs
- NetSectionGroup.cs
- TextWriterTraceListener.cs
- SafeFileMappingHandle.cs
- RecommendedAsConfigurableAttribute.cs
- ClipboardData.cs
- DPAPIProtectedConfigurationProvider.cs
- AppModelKnownContentFactory.cs
- GridViewRow.cs
- OwnerDrawPropertyBag.cs
- SHA512Managed.cs
- regiisutil.cs
- FixedTextBuilder.cs
- EventData.cs
- securestring.cs
- CounterCreationDataCollection.cs
- PrivateFontCollection.cs
- AppDomainUnloadedException.cs
- ContentElement.cs
- COM2ExtendedUITypeEditor.cs
- OleDbConnectionInternal.cs
- EntityConnectionStringBuilderItem.cs
- DataGridViewDesigner.cs
- Interlocked.cs
- EnumValidator.cs
- FSWPathEditor.cs
- ExtensionDataReader.cs
- PathFigureCollectionConverter.cs