Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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 } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- InputScopeAttribute.cs
- ExclusiveTcpListener.cs
- XmlFormatReaderGenerator.cs
- MenuItemStyleCollectionEditor.cs
- DocumentApplicationJournalEntry.cs
- HyperLinkDataBindingHandler.cs
- PriorityQueue.cs
- ToolStripPanelRenderEventArgs.cs
- EnumBuilder.cs
- SplitterEvent.cs
- Bits.cs
- Stylesheet.cs
- _AutoWebProxyScriptHelper.cs
- GridViewSortEventArgs.cs
- SafeFileMappingHandle.cs
- TransformerInfoCollection.cs
- MLangCodePageEncoding.cs
- MediaTimeline.cs
- DesignerAttribute.cs
- CopyAction.cs
- UrlAuthFailedErrorFormatter.cs
- DataSourceControlBuilder.cs
- DataGridViewButtonCell.cs
- CipherData.cs
- MultipleViewPattern.cs
- ZipFileInfo.cs
- ExclusiveHandleList.cs
- SubclassTypeValidator.cs
- DataSourceControl.cs
- HandlerFactoryWrapper.cs
- TextPointer.cs
- ControllableStoryboardAction.cs
- __TransparentProxy.cs
- CryptoApi.cs
- ControlValuePropertyAttribute.cs
- WindowsFormsHostPropertyMap.cs
- InstanceHandleConflictException.cs
- CheckBoxList.cs
- DataGridViewTextBoxColumn.cs
- TraversalRequest.cs
- ViewgenContext.cs
- RelatedImageListAttribute.cs
- PassportAuthentication.cs
- AppDomainAttributes.cs
- InvalidCommandTreeException.cs
- XmlSchemaSimpleTypeList.cs
- QueuePathEditor.cs
- GlobalProxySelection.cs
- MetadataSet.cs
- BamlRecordHelper.cs
- InvalidProgramException.cs
- TokenDescriptor.cs
- HttpConfigurationContext.cs
- RangeValueProviderWrapper.cs
- HostedImpersonationContext.cs
- SafeCertificateStore.cs
- EncryptedPackage.cs
- DeferredElementTreeState.cs
- ActivityDesignerHelper.cs
- DetailsViewRow.cs
- DesigntimeLicenseContext.cs
- EventLog.cs
- SqlNotificationRequest.cs
- DefaultShape.cs
- MessageQueueTransaction.cs
- XmlSortKey.cs
- ServiceNotStartedException.cs
- DesignerVerbCollection.cs
- TcpConnectionPoolSettingsElement.cs
- GenericTextProperties.cs
- DateTimeConverter.cs
- ChangeNode.cs
- TdsParameterSetter.cs
- RegexTree.cs
- DynamicValidatorEventArgs.cs
- WindowsComboBox.cs
- XmlUtil.cs
- ReadOnlyDictionary.cs
- SmtpDigestAuthenticationModule.cs
- BinaryFormatter.cs
- MatrixAnimationUsingKeyFrames.cs
- SqlDataSourceCommandParser.cs
- StringInfo.cs
- ActiveDesignSurfaceEvent.cs
- SrgsRule.cs
- ListParaClient.cs
- ActivityBuilderXamlWriter.cs
- WizardPanel.cs
- TextBox.cs
- SystemNetworkInterface.cs
- SocketElement.cs
- LifetimeServices.cs
- RegistrationServices.cs
- XhtmlBasicPhoneCallAdapter.cs
- CodeDirectionExpression.cs
- SettingsProviderCollection.cs
- BaseTemplateBuildProvider.cs
- webclient.cs
- DistinctQueryOperator.cs
- MatrixTransform3D.cs