Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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. // //----------------------------------------------------------------------------- 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EntryPointNotFoundException.cs
- XmlAttributeCollection.cs
- ConcurrentDictionary.cs
- BitmapFrameDecode.cs
- SpellerStatusTable.cs
- XmlLoader.cs
- TransportBindingElement.cs
- UnknownMessageReceivedEventArgs.cs
- WriteFileContext.cs
- XmlQueryTypeFactory.cs
- SchemaManager.cs
- VisualTreeUtils.cs
- XsdBuildProvider.cs
- BitmapDownload.cs
- SHA384CryptoServiceProvider.cs
- GridItemPatternIdentifiers.cs
- uribuilder.cs
- CallbackTimeoutsElement.cs
- RegistrySecurity.cs
- OrderByBuilder.cs
- SmiEventSink.cs
- ErrorWrapper.cs
- PointValueSerializer.cs
- OdbcConnectionHandle.cs
- ZipArchive.cs
- MenuItem.cs
- DependencyPropertyAttribute.cs
- SmtpFailedRecipientsException.cs
- ExpressionValueEditor.cs
- EraserBehavior.cs
- BooleanAnimationBase.cs
- WebConfigurationHost.cs
- TextTreeTextNode.cs
- InProcStateClientManager.cs
- TransactionManager.cs
- BindingContext.cs
- PostBackTrigger.cs
- EncodingNLS.cs
- BuildManager.cs
- MenuItemStyleCollection.cs
- ModelVisual3D.cs
- DependencyObjectPropertyDescriptor.cs
- XmlDocument.cs
- EdmType.cs
- UDPClient.cs
- SmiEventSink.cs
- ExtendedPropertyDescriptor.cs
- DataTableReaderListener.cs
- GestureRecognitionResult.cs
- SQLUtility.cs
- FontCacheLogic.cs
- ProfileSection.cs
- PriorityBindingExpression.cs
- XmlCountingReader.cs
- CallbackHandler.cs
- RequestCacheEntry.cs
- ElementsClipboardData.cs
- ComboBoxDesigner.cs
- IPAddress.cs
- ServiceDescriptionImporter.cs
- MutexSecurity.cs
- RegexTree.cs
- CreateUserWizardStep.cs
- EntityDataSourceWrapperCollection.cs
- SwitchLevelAttribute.cs
- BrowserCapabilitiesCodeGenerator.cs
- LinkLabelLinkClickedEvent.cs
- HyperLinkStyle.cs
- EventLogReader.cs
- BitStack.cs
- LiteralDesigner.cs
- MaterialGroup.cs
- DataTable.cs
- EncryptedData.cs
- WindowsListViewItem.cs
- SignedInfo.cs
- FirstMatchCodeGroup.cs
- ToolbarAUtomationPeer.cs
- Activator.cs
- path.cs
- WriteableBitmap.cs
- XamlToRtfWriter.cs
- EventBuilder.cs
- SizeF.cs
- CustomBindingElement.cs
- ActivityWithResult.cs
- ZeroOpNode.cs
- ParameterCollection.cs
- TypographyProperties.cs
- WindowsListViewItemCheckBox.cs
- BuilderInfo.cs
- BezierSegment.cs
- DrawingAttributes.cs
- BamlWriter.cs
- BinHexDecoder.cs
- SemanticResultValue.cs
- mongolianshape.cs
- XmlRawWriterWrapper.cs
- SqlDataSourceView.cs
- FormClosingEvent.cs