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
- PaintEvent.cs
- SecurityStateEncoder.cs
- DoubleUtil.cs
- WorkflowPersistenceService.cs
- VectorAnimationBase.cs
- SelectionProcessor.cs
- ExclusiveCanonicalizationTransform.cs
- EventItfInfo.cs
- ConfigurationSectionCollection.cs
- TokenizerHelper.cs
- DataBindEngine.cs
- DataColumnCollection.cs
- OleDbConnectionFactory.cs
- WebPartChrome.cs
- ParseHttpDate.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- WindowsListViewScroll.cs
- MetadataException.cs
- HandlerWithFactory.cs
- ProxyRpc.cs
- ExclusiveTcpListener.cs
- VectorKeyFrameCollection.cs
- Header.cs
- UrlPath.cs
- XmlUrlResolver.cs
- SchemaCollectionCompiler.cs
- RadioButton.cs
- PeerCollaborationPermission.cs
- NamespaceList.cs
- LoggedException.cs
- XmlSigningNodeWriter.cs
- StylusDevice.cs
- SEHException.cs
- PathStreamGeometryContext.cs
- Section.cs
- HotCommands.cs
- Hex.cs
- BitmapEffect.cs
- InternalSafeNativeMethods.cs
- SimpleRecyclingCache.cs
- FixedNode.cs
- MetaForeignKeyColumn.cs
- LambdaCompiler.cs
- ValueConversionAttribute.cs
- EncryptRequest.cs
- Msec.cs
- ZipFileInfo.cs
- TextTreeUndoUnit.cs
- HtmlLink.cs
- TabletCollection.cs
- RuntimeCompatibilityAttribute.cs
- BindingSource.cs
- LiteralDesigner.cs
- QueryContinueDragEventArgs.cs
- ToolboxItemWrapper.cs
- IdentityValidationException.cs
- OdbcEnvironmentHandle.cs
- PenLineJoinValidation.cs
- newinstructionaction.cs
- QilTypeChecker.cs
- TextDecorationLocationValidation.cs
- DefinitionBase.cs
- CodeTypeReference.cs
- ParentQuery.cs
- FormViewModeEventArgs.cs
- TextFindEngine.cs
- FactoryGenerator.cs
- DiscoveryExceptionDictionary.cs
- ProfileGroupSettings.cs
- MailSettingsSection.cs
- ValidationError.cs
- ExpressionBindingCollection.cs
- TranslateTransform.cs
- Timer.cs
- TextRangeProviderWrapper.cs
- JournalEntryListConverter.cs
- ScriptControlManager.cs
- FieldNameLookup.cs
- EmptyStringExpandableObjectConverter.cs
- NumericExpr.cs
- ToolboxDataAttribute.cs
- GregorianCalendar.cs
- ToolStripItemTextRenderEventArgs.cs
- MILUtilities.cs
- AtomMaterializerLog.cs
- IdleTimeoutMonitor.cs
- EmulateRecognizeCompletedEventArgs.cs
- InitializeCorrelation.cs
- DocumentOrderQuery.cs
- ToolStripDesignerAvailabilityAttribute.cs
- CapabilitiesSection.cs
- StructureChangedEventArgs.cs
- Binding.cs
- NonDualMessageSecurityOverHttp.cs
- MemberNameValidator.cs
- SqlDataSource.cs
- ListContractAdapter.cs
- UIElementHelper.cs
- AccessDataSourceView.cs
- UserControlBuildProvider.cs