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
- ToolStripTextBox.cs
- BitmapSourceSafeMILHandle.cs
- SafeEventLogWriteHandle.cs
- DomainUpDown.cs
- _SslStream.cs
- ContextQuery.cs
- WindowsFont.cs
- EdmEntityTypeAttribute.cs
- DependencyPropertyConverter.cs
- TdsRecordBufferSetter.cs
- XmlDataLoader.cs
- StrokeNodeEnumerator.cs
- WorkerRequest.cs
- wgx_commands.cs
- HttpStreamMessageEncoderFactory.cs
- SerializationSectionGroup.cs
- RegexParser.cs
- PeerApplication.cs
- PointAnimationUsingPath.cs
- SplineKeyFrames.cs
- MissingManifestResourceException.cs
- TextServicesContext.cs
- XmlNodeReader.cs
- WebBrowserHelper.cs
- DefaultParameterValueAttribute.cs
- ColorAnimation.cs
- ObjectRef.cs
- FixedDocumentPaginator.cs
- ValuePattern.cs
- ResolveDuplex11AsyncResult.cs
- WebZone.cs
- WebPartChrome.cs
- BufferBuilder.cs
- SortedDictionary.cs
- DataObjectEventArgs.cs
- AutomationProperty.cs
- SuppressMessageAttribute.cs
- LingerOption.cs
- Keywords.cs
- XmlAutoDetectWriter.cs
- InternalCache.cs
- GregorianCalendar.cs
- TdsParser.cs
- EditingScope.cs
- WebPartZone.cs
- XmlCDATASection.cs
- ExpressionBinding.cs
- Transform.cs
- TableRow.cs
- MetadataItem_Static.cs
- HostingEnvironment.cs
- UpdateDelegates.Generated.cs
- UpdatePanelTrigger.cs
- BigInt.cs
- BamlLocalizableResourceKey.cs
- FormViewDeletedEventArgs.cs
- CqlErrorHelper.cs
- BamlResourceDeserializer.cs
- BinaryKeyIdentifierClause.cs
- SortedSetDebugView.cs
- TimeSpanSecondsConverter.cs
- SpeechDetectedEventArgs.cs
- Model3DCollection.cs
- SqlConnectionPoolProviderInfo.cs
- IRCollection.cs
- AuthenticationService.cs
- PrintDialogException.cs
- SerializationObjectManager.cs
- Collection.cs
- EntitySqlQueryCacheEntry.cs
- SqlLiftIndependentRowExpressions.cs
- GraphicsContainer.cs
- XmlQueryType.cs
- EngineSiteSapi.cs
- HWStack.cs
- HwndHost.cs
- ObjRef.cs
- DataRowComparer.cs
- SafeFileMappingHandle.cs
- SystemColors.cs
- TreeNodeBindingCollection.cs
- RuntimeConfig.cs
- KeyPullup.cs
- XomlCompiler.cs
- SystemBrushes.cs
- ProcessThreadCollection.cs
- XmlSchemaDocumentation.cs
- ProjectionPruner.cs
- TreeNodeCollection.cs
- Logging.cs
- PerformanceCounterCategory.cs
- TextDecorationLocationValidation.cs
- TempEnvironment.cs
- UInt32.cs
- oledbmetadatacolumnnames.cs
- ServiceBusyException.cs
- MessageFilterTable.cs
- SoapFormatterSinks.cs
- GridViewDeleteEventArgs.cs
- BindingMAnagerBase.cs