Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XhtmlBasicPanelAdapter.cs
- DependencyObject.cs
- SharedDp.cs
- LinkLabelLinkClickedEvent.cs
- BezierSegment.cs
- DataGridCaption.cs
- DataGridCommandEventArgs.cs
- XsdDataContractExporter.cs
- ManagedWndProcTracker.cs
- GridViewColumn.cs
- ProgressiveCrcCalculatingStream.cs
- Token.cs
- LifetimeServices.cs
- StorageBasedPackageProperties.cs
- ManifestBasedResourceGroveler.cs
- CollectionEditor.cs
- SR.cs
- SqlPersonalizationProvider.cs
- SQLDateTimeStorage.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- Button.cs
- CompilerCollection.cs
- FilteredXmlReader.cs
- TraceInternal.cs
- WriteTimeStream.cs
- RtfToXamlReader.cs
- PersonalizablePropertyEntry.cs
- SystemResources.cs
- CommandLibraryHelper.cs
- RectangleGeometry.cs
- VideoDrawing.cs
- IDataContractSurrogate.cs
- ComponentCollection.cs
- SettingsProviderCollection.cs
- XmlBinaryReader.cs
- MailHeaderInfo.cs
- MaskedTextBox.cs
- DocumentPageViewAutomationPeer.cs
- ReflectionTypeLoadException.cs
- WpfWebRequestHelper.cs
- SerializationHelper.cs
- RegularExpressionValidator.cs
- ActivityExecutionWorkItem.cs
- XmlSchemaAnyAttribute.cs
- FontSizeConverter.cs
- _NegotiateClient.cs
- WebPartZoneBase.cs
- XpsStructure.cs
- recordstatescratchpad.cs
- StrongBox.cs
- SqlIdentifier.cs
- EditorZoneDesigner.cs
- AlignmentXValidation.cs
- ModelPerspective.cs
- StylusPoint.cs
- RootCodeDomSerializer.cs
- CapabilitiesState.cs
- SocketException.cs
- coordinator.cs
- ChangesetResponse.cs
- Literal.cs
- QuestionEventArgs.cs
- InlineObject.cs
- ClientSession.cs
- ManagementScope.cs
- TableDetailsRow.cs
- TemplateControlBuildProvider.cs
- DataBoundControlAdapter.cs
- Condition.cs
- RelationshipFixer.cs
- ContentOperations.cs
- MulticastOption.cs
- _LocalDataStore.cs
- FormDocumentDesigner.cs
- ColorAnimation.cs
- Connection.cs
- ConfigXmlText.cs
- EUCJPEncoding.cs
- EdmItemCollection.cs
- GatewayDefinition.cs
- TextServicesProperty.cs
- EqualityComparer.cs
- HandleExceptionArgs.cs
- BinHexDecoder.cs
- ConsumerConnectionPointCollection.cs
- SymmetricKeyWrap.cs
- ProfilePropertyNameValidator.cs
- DataObject.cs
- SafeThreadHandle.cs
- PanelStyle.cs
- EntityWrapperFactory.cs
- ComplexBindingPropertiesAttribute.cs
- ProbeDuplexCD1AsyncResult.cs
- OLEDB_Util.cs
- PositiveTimeSpanValidatorAttribute.cs
- PageStatePersister.cs
- DetailsViewInsertEventArgs.cs
- CmsUtils.cs
- TextRangeEditLists.cs
- SecurityKeyType.cs