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
- EditorBrowsableAttribute.cs
- CompositeFontFamily.cs
- TranslateTransform.cs
- SoapExtension.cs
- DateTimePicker.cs
- AddInController.cs
- ListBoxItemAutomationPeer.cs
- SynchronizationValidator.cs
- diagnosticsswitches.cs
- TraceContext.cs
- PersonalizationStateQuery.cs
- SessionIDManager.cs
- PreviewKeyDownEventArgs.cs
- HostingEnvironmentWrapper.cs
- Brushes.cs
- MethodImplAttribute.cs
- JsonDeserializer.cs
- XmlTextReaderImplHelpers.cs
- DiscriminatorMap.cs
- validationstate.cs
- ChineseLunisolarCalendar.cs
- MessagePartSpecification.cs
- XmlStreamStore.cs
- UidManager.cs
- XmlSchemaImport.cs
- ReliableRequestSessionChannel.cs
- CqlQuery.cs
- TableChangeProcessor.cs
- WebEvents.cs
- SocketAddress.cs
- URL.cs
- UserControl.cs
- Attributes.cs
- ItemsControl.cs
- DataGridViewImageCell.cs
- CapabilitiesSection.cs
- WindowsGrip.cs
- HtmlWindowCollection.cs
- TextDecorationCollectionConverter.cs
- FontNamesConverter.cs
- DataGridViewComboBoxEditingControl.cs
- altserialization.cs
- BamlTreeMap.cs
- BuildManager.cs
- CompoundFileIOPermission.cs
- TokenizerHelper.cs
- DropSource.cs
- SqlReorderer.cs
- DelayedRegex.cs
- DocumentStatusResources.cs
- FormCollection.cs
- TextEffectCollection.cs
- LinqDataSourceEditData.cs
- Floater.cs
- TextAction.cs
- StateDesigner.Layouts.cs
- Evaluator.cs
- SchemaMapping.cs
- FileDetails.cs
- FtpRequestCacheValidator.cs
- StringToken.cs
- HashCodeCombiner.cs
- DispatchChannelSink.cs
- SmiContextFactory.cs
- PieceDirectory.cs
- DataKey.cs
- StringValidator.cs
- Mapping.cs
- SeverityFilter.cs
- AstTree.cs
- MatrixConverter.cs
- LocatorBase.cs
- ExtendedPropertyDescriptor.cs
- Module.cs
- CollectionConverter.cs
- IsolatedStoragePermission.cs
- PathGeometry.cs
- PresentationAppDomainManager.cs
- EmptyStringExpandableObjectConverter.cs
- DoubleAnimationClockResource.cs
- WCFModelStrings.Designer.cs
- StdValidatorsAndConverters.cs
- sqlpipe.cs
- ComponentResourceKey.cs
- LoginView.cs
- DBConcurrencyException.cs
- PtsContext.cs
- IpcClientManager.cs
- HttpWrapper.cs
- TextContainerChangedEventArgs.cs
- XmlToDatasetMap.cs
- DebugView.cs
- HostingEnvironment.cs
- JavaScriptString.cs
- FlowDocumentView.cs
- SoapIncludeAttribute.cs
- ClientOptions.cs
- HttpCachePolicyElement.cs
- Convert.cs
- MessagePropertyAttribute.cs