Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Decimal.cs
- DoubleLink.cs
- AsyncResult.cs
- RestHandler.cs
- SqlDelegatedTransaction.cs
- ReachIDocumentPaginatorSerializerAsync.cs
- CachedFontFace.cs
- DataServiceClientException.cs
- DataGridViewLinkCell.cs
- TextLineResult.cs
- ColorTransform.cs
- WindowsRebar.cs
- System.Data_BID.cs
- SafeFindHandle.cs
- BamlTreeMap.cs
- Identifier.cs
- SecurityAlgorithmSuite.cs
- IndicShape.cs
- SecurityManager.cs
- BitmapEffectInputConnector.cs
- SqlDataSourceFilteringEventArgs.cs
- PartEditor.cs
- ApplyHostConfigurationBehavior.cs
- DBAsyncResult.cs
- InputBindingCollection.cs
- ReadOnlyDataSource.cs
- ProcessInfo.cs
- BigIntegerStorage.cs
- KeyNotFoundException.cs
- SuppressMessageAttribute.cs
- XmlSchemaInclude.cs
- ScrollProperties.cs
- CompilationLock.cs
- ContextMenuStrip.cs
- TargetPerspective.cs
- HtmlInputPassword.cs
- TypeElement.cs
- TransactionInformation.cs
- IProducerConsumerCollection.cs
- DispatcherEventArgs.cs
- WebPartVerb.cs
- FixedFindEngine.cs
- BezierSegment.cs
- DoubleLinkListEnumerator.cs
- SafeRightsManagementPubHandle.cs
- ImageBrush.cs
- MissingManifestResourceException.cs
- CreateUserWizardStep.cs
- ErrorFormatterPage.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ExportOptions.cs
- ProcessHostMapPath.cs
- DataGridViewIntLinkedList.cs
- CodeTypeParameter.cs
- Blend.cs
- CompositeFontParser.cs
- RoleManagerSection.cs
- DeviceContexts.cs
- SecurityUtils.cs
- MailWriter.cs
- FacetValues.cs
- ScrollPattern.cs
- control.ime.cs
- NamedObject.cs
- AnimationLayer.cs
- PersistenceMetadataNamespace.cs
- ExceptionUtil.cs
- TrackingProfileSerializer.cs
- Latin1Encoding.cs
- GlyphElement.cs
- DetailsViewInsertEventArgs.cs
- MessageDecoder.cs
- WorkflowView.cs
- ComponentSerializationService.cs
- RowUpdatedEventArgs.cs
- XmlSignatureProperties.cs
- MessageOperationFormatter.cs
- DataSourceListEditor.cs
- SerializationBinder.cs
- HandleRef.cs
- FormatException.cs
- DynamicPhysicalDiscoSearcher.cs
- UnauthorizedWebPart.cs
- PolicyUnit.cs
- PartialCachingAttribute.cs
- RecognizerBase.cs
- SQLBytes.cs
- EntityDataSourceContextDisposingEventArgs.cs
- VirtualPathData.cs
- SplashScreenNativeMethods.cs
- DetailsViewUpdatedEventArgs.cs
- PointAnimation.cs
- EdmItemCollection.cs
- CompoundFileReference.cs
- HttpCacheVary.cs
- PageBuildProvider.cs
- DateBoldEvent.cs
- ServiceInstanceProvider.cs
- SessionParameter.cs
- infer.cs