Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlSortKeyAccumulator.cs
- UpdatableGenericsFeature.cs
- Assembly.cs
- TreeBuilderBamlTranslator.cs
- Content.cs
- DataProtection.cs
- FormCollection.cs
- DateTimeFormatInfo.cs
- PropertyKey.cs
- Paragraph.cs
- ResourceAttributes.cs
- Geometry.cs
- StringUtil.cs
- DragDropManager.cs
- VerificationAttribute.cs
- PrintDocument.cs
- PeerDuplexChannel.cs
- SplitterCancelEvent.cs
- CustomSignedXml.cs
- DtrList.cs
- XslNumber.cs
- AccessDataSourceView.cs
- Rotation3D.cs
- Fonts.cs
- ServiceElementCollection.cs
- TargetControlTypeAttribute.cs
- XmlSchemaNotation.cs
- Mapping.cs
- ClientEventManager.cs
- EntityStoreSchemaGenerator.cs
- SignalGate.cs
- SqlCommandSet.cs
- SessionSwitchEventArgs.cs
- HtmlTextArea.cs
- Literal.cs
- OleDbReferenceCollection.cs
- XmlnsCompatibleWithAttribute.cs
- DoubleLinkList.cs
- SqlComparer.cs
- NodeInfo.cs
- Matrix3DValueSerializer.cs
- MessageSmuggler.cs
- BitmapDownload.cs
- AddingNewEventArgs.cs
- SqlCacheDependencyDatabaseCollection.cs
- DmlSqlGenerator.cs
- XmlArrayAttribute.cs
- VBCodeProvider.cs
- Int32AnimationUsingKeyFrames.cs
- TypeConverterHelper.cs
- WpfWebRequestHelper.cs
- PackagePartCollection.cs
- GZipStream.cs
- WizardForm.cs
- TimeoutException.cs
- TextProviderWrapper.cs
- PrimitiveXmlSerializers.cs
- JournalEntryStack.cs
- Brush.cs
- PointHitTestResult.cs
- MetadataSource.cs
- AutoResizedEvent.cs
- MimeTypeMapper.cs
- MergablePropertyAttribute.cs
- EntityTypeEmitter.cs
- GeneralTransform3DTo2DTo3D.cs
- LazyTextWriterCreator.cs
- XmlTypeAttribute.cs
- ArrayEditor.cs
- PopupEventArgs.cs
- DashStyle.cs
- QueueProcessor.cs
- EditBehavior.cs
- Compress.cs
- GetImportFileNameRequest.cs
- PropertyCondition.cs
- TextServicesProperty.cs
- FormDesigner.cs
- OlePropertyStructs.cs
- ClrProviderManifest.cs
- DefaultPropertyAttribute.cs
- smtppermission.cs
- OlePropertyStructs.cs
- SpeechDetectedEventArgs.cs
- QueryCursorEventArgs.cs
- ForceCopyBuildProvider.cs
- DefaultDialogButtons.cs
- FlowDocumentFormatter.cs
- DocumentViewerBase.cs
- ChtmlImageAdapter.cs
- DesignerActionUIService.cs
- FontEditor.cs
- BaseCAMarshaler.cs
- StateChangeEvent.cs
- AdPostCacheSubstitution.cs
- nulltextcontainer.cs
- NullableDoubleSumAggregationOperator.cs
- DbProviderSpecificTypePropertyAttribute.cs
- StatusBarDrawItemEvent.cs
- _ScatterGatherBuffers.cs