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
- EmptyControlCollection.cs
- VariableBinder.cs
- CqlWriter.cs
- FormsAuthenticationUserCollection.cs
- EventDescriptorCollection.cs
- Vector3DConverter.cs
- HttpCookiesSection.cs
- StringKeyFrameCollection.cs
- DataGridViewLinkColumn.cs
- DbParameterCollection.cs
- ClientFormsAuthenticationCredentials.cs
- StylusPointPropertyInfo.cs
- MDIControlStrip.cs
- XmlReflectionImporter.cs
- PropertyStore.cs
- HtmlControl.cs
- XmlChoiceIdentifierAttribute.cs
- activationcontext.cs
- PlainXmlDeserializer.cs
- MasterPageParser.cs
- StylusPoint.cs
- SynchronizedPool.cs
- SqlClientWrapperSmiStream.cs
- ParallelTimeline.cs
- PseudoWebRequest.cs
- SqlExpressionNullability.cs
- DateTimeValueSerializer.cs
- WsdlBuildProvider.cs
- TemplateAction.cs
- CustomLineCap.cs
- FillBehavior.cs
- XsdValidatingReader.cs
- EditorAttribute.cs
- FileInfo.cs
- SupportsPreviewControlAttribute.cs
- AssemblyHash.cs
- TextServicesProperty.cs
- ConfigurationStrings.cs
- ManagedIStream.cs
- TransformValueSerializer.cs
- EntryIndex.cs
- XmlWellformedWriterHelpers.cs
- ProtocolsConfigurationEntry.cs
- HtmlControlPersistable.cs
- InternalDuplexChannelFactory.cs
- SequenceQuery.cs
- DataServiceQueryOfT.cs
- ConfigurationPropertyAttribute.cs
- SpellerHighlightLayer.cs
- LocalValueEnumerator.cs
- AttachedPropertiesService.cs
- BigInt.cs
- RegularExpressionValidator.cs
- PanelDesigner.cs
- GridViewSortEventArgs.cs
- FileDialog_Vista.cs
- PtsHelper.cs
- AssociationTypeEmitter.cs
- TextElementAutomationPeer.cs
- TypographyProperties.cs
- RectAnimationUsingKeyFrames.cs
- SmtpMail.cs
- RootBuilder.cs
- StringInfo.cs
- ContainerActivationHelper.cs
- EditorAttribute.cs
- CodeMemberMethod.cs
- DependencyPropertyConverter.cs
- MessageBox.cs
- EntryWrittenEventArgs.cs
- XmlSchemaSequence.cs
- LeaseManager.cs
- RepeaterItemEventArgs.cs
- messageonlyhwndwrapper.cs
- AliasGenerator.cs
- ErrorWebPart.cs
- MemberRelationshipService.cs
- AxHostDesigner.cs
- SimpleBitVector32.cs
- CapabilitiesRule.cs
- ImageCodecInfoPrivate.cs
- SignerInfo.cs
- Stroke2.cs
- SocketPermission.cs
- Zone.cs
- TableColumn.cs
- FixedFindEngine.cs
- RawKeyboardInputReport.cs
- ToolStripDropTargetManager.cs
- DesignerProperties.cs
- TypeCacheManager.cs
- ComponentChangedEvent.cs
- EntitySqlQueryCacheKey.cs
- WebPartDisplayModeCollection.cs
- AuthenticatingEventArgs.cs
- CopyOnWriteList.cs
- XmlSchemaObjectCollection.cs
- TextEndOfSegment.cs
- MappingException.cs
- TreeViewHitTestInfo.cs