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
- FrameworkObject.cs
- ImpersonationContext.cs
- CheckBoxBaseAdapter.cs
- TypefaceMetricsCache.cs
- AdvancedBindingPropertyDescriptor.cs
- GridItemPattern.cs
- FieldAccessException.cs
- Rect3DConverter.cs
- RadioButton.cs
- ITextView.cs
- ImageBrush.cs
- XmlLinkedNode.cs
- Quack.cs
- TypeSemantics.cs
- SqlUnionizer.cs
- FormViewInsertedEventArgs.cs
- MSAANativeProvider.cs
- CodeTypeReference.cs
- XmlChildEnumerator.cs
- RenderDataDrawingContext.cs
- DataControlLinkButton.cs
- SequentialUshortCollection.cs
- querybuilder.cs
- OperationValidationEventArgs.cs
- BCLDebug.cs
- SynchronizationContext.cs
- ColorConverter.cs
- Switch.cs
- SimpleHandlerBuildProvider.cs
- BooleanProjectedSlot.cs
- MessageFilterTable.cs
- DesignerAdapterAttribute.cs
- XmlEncodedRawTextWriter.cs
- PointLight.cs
- XsltFunctions.cs
- httpstaticobjectscollection.cs
- Attachment.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- FieldNameLookup.cs
- ApplyImportsAction.cs
- WebPartCancelEventArgs.cs
- BindableTemplateBuilder.cs
- SqlStatistics.cs
- NavigationCommands.cs
- PreviewPrintController.cs
- CDSCollectionETWBCLProvider.cs
- ConfigXmlText.cs
- DbParameterCollectionHelper.cs
- ReadOnlyTernaryTree.cs
- MostlySingletonList.cs
- BindingsCollection.cs
- RelationshipDetailsRow.cs
- WebPartMenu.cs
- Line.cs
- ClockController.cs
- GatewayIPAddressInformationCollection.cs
- XmlEventCache.cs
- storepermissionattribute.cs
- HostDesigntimeLicenseContext.cs
- Int16AnimationBase.cs
- MediaContextNotificationWindow.cs
- SiteMapPath.cs
- XamlSerializerUtil.cs
- ReadOnlyHierarchicalDataSourceView.cs
- ManipulationPivot.cs
- PtsPage.cs
- HuffCodec.cs
- __FastResourceComparer.cs
- M3DUtil.cs
- PackageStore.cs
- HttpServerChannel.cs
- ProcessManager.cs
- NavigationFailedEventArgs.cs
- CompositeDataBoundControl.cs
- WebPartConnectionsDisconnectVerb.cs
- MissingMethodException.cs
- HeaderedContentControl.cs
- AnnotationHighlightLayer.cs
- ValueQuery.cs
- Pair.cs
- NamespaceEmitter.cs
- StorageModelBuildProvider.cs
- TextEditorTyping.cs
- OracleException.cs
- TransformerInfo.cs
- ApplicationServiceHelper.cs
- UserPreferenceChangingEventArgs.cs
- IRCollection.cs
- SequenceNumber.cs
- OdbcException.cs
- XmlSerializableReader.cs
- TableHeaderCell.cs
- ConnectionPoint.cs
- ShutDownListener.cs
- GeometryHitTestParameters.cs
- HuffmanTree.cs
- Utility.cs
- ExtensionFile.cs
- SoapDocumentMethodAttribute.cs
- LocalizableAttribute.cs