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
- HostingEnvironment.cs
- IResourceProvider.cs
- ToolStripDropDownDesigner.cs
- ScriptMethodAttribute.cs
- LongValidatorAttribute.cs
- XmlSchemaAnnotation.cs
- RadioButtonAutomationPeer.cs
- NotConverter.cs
- DoubleLink.cs
- loginstatus.cs
- Rotation3DKeyFrameCollection.cs
- QilTargetType.cs
- MemoryMappedFile.cs
- CalculatedColumn.cs
- OdbcConnectionStringbuilder.cs
- DataServiceException.cs
- ConnectionStringSettingsCollection.cs
- TdsParser.cs
- DeviceContexts.cs
- HandlerBase.cs
- InputScope.cs
- EntityDesignerDataSourceView.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- PenLineCapValidation.cs
- HGlobalSafeHandle.cs
- ComponentEditorPage.cs
- UdpDiscoveryEndpoint.cs
- QilBinary.cs
- BaseTemplateCodeDomTreeGenerator.cs
- CreateRefExpr.cs
- QilNode.cs
- Scheduler.cs
- Variable.cs
- CollectionViewProxy.cs
- RectAnimationUsingKeyFrames.cs
- PriorityBinding.cs
- XPathEmptyIterator.cs
- StatusBarPanel.cs
- EventArgs.cs
- Stacktrace.cs
- FrameworkContentElementAutomationPeer.cs
- ServiceModelInstallComponent.cs
- SecurityTokenProvider.cs
- IResourceProvider.cs
- MSAANativeProvider.cs
- LZCodec.cs
- Int16Storage.cs
- Selection.cs
- HtmlInputButton.cs
- FacetValueContainer.cs
- DataControlFieldCollection.cs
- TemplateBindingExpression.cs
- EraserBehavior.cs
- CustomMenuItemCollection.cs
- XmlArrayAttribute.cs
- CryptoHandle.cs
- ResourceDisplayNameAttribute.cs
- TrackingProfileDeserializationException.cs
- ZipIOExtraFieldElement.cs
- HttpModuleAction.cs
- Border.cs
- WindowsPrincipal.cs
- ObjectConverter.cs
- ButtonBaseAdapter.cs
- XPathNavigatorKeyComparer.cs
- Tokenizer.cs
- ViewValidator.cs
- ISFTagAndGuidCache.cs
- HttpTransportManager.cs
- RuntimeEnvironment.cs
- RawStylusInput.cs
- IncrementalHitTester.cs
- KnowledgeBase.cs
- TraceProvider.cs
- HtmlElementEventArgs.cs
- PrivilegedConfigurationManager.cs
- ToolStripDropDownClosingEventArgs.cs
- control.ime.cs
- TreeNode.cs
- GraphicsState.cs
- RoleGroupCollectionEditor.cs
- UInt32Converter.cs
- WindowsTokenRoleProvider.cs
- DataSourceSelectArguments.cs
- Int64.cs
- RSAPKCS1SignatureDeformatter.cs
- BaseInfoTable.cs
- EndpointAddressMessageFilterTable.cs
- OSFeature.cs
- Metafile.cs
- GeneralTransformCollection.cs
- WebPartDisplayMode.cs
- SpecialNameAttribute.cs
- XslCompiledTransform.cs
- DefaultTextStore.cs
- XPathSingletonIterator.cs
- QueryExpression.cs
- ProgressBarAutomationPeer.cs
- UserControl.cs
- ClientScriptManager.cs