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
- ProxyWebPartConnectionCollection.cs
- SpeakInfo.cs
- DataGridHeaderBorder.cs
- ErrorStyle.cs
- DPAPIProtectedConfigurationProvider.cs
- HttpHandlersSection.cs
- DataTrigger.cs
- QilInvokeLateBound.cs
- ResourceBinder.cs
- XmlSignatureManifest.cs
- ServiceChannel.cs
- StorageEntityTypeMapping.cs
- TCPClient.cs
- SemaphoreSecurity.cs
- SamlSecurityToken.cs
- ToolStripDropDownButton.cs
- WindowInteractionStateTracker.cs
- DataGridColumnHeaderAutomationPeer.cs
- SolidBrush.cs
- ObjectMemberMapping.cs
- ObjectDataSourceMethodEditor.cs
- BufferedMessageWriter.cs
- MetaForeignKeyColumn.cs
- UndirectedGraph.cs
- XmlWriter.cs
- ToolStripDropDown.cs
- SendActivityEventArgs.cs
- RedirectionProxy.cs
- TextElementEditingBehaviorAttribute.cs
- Size.cs
- BufferCache.cs
- WmpBitmapDecoder.cs
- CompatibleComparer.cs
- ServiceParser.cs
- EntityStoreSchemaGenerator.cs
- EntityDataSourceDesignerHelper.cs
- WebConfigurationManager.cs
- PackageProperties.cs
- HMAC.cs
- ActiveXHost.cs
- HijriCalendar.cs
- D3DImage.cs
- EntryWrittenEventArgs.cs
- ObjectSpanRewriter.cs
- SoapAttributeOverrides.cs
- Rotation3DAnimationBase.cs
- Drawing.cs
- MsmqTransportBindingElement.cs
- LinkConverter.cs
- CodeVariableDeclarationStatement.cs
- IgnoreFlushAndCloseStream.cs
- DataIdProcessor.cs
- VirtualPathUtility.cs
- MasterPageParser.cs
- TdsParserStateObject.cs
- FormsAuthenticationConfiguration.cs
- MapPathBasedVirtualPathProvider.cs
- ConnectionInterfaceCollection.cs
- SecurityBindingElement.cs
- Exceptions.cs
- PermissionToken.cs
- EditorAttribute.cs
- ReceiveCompletedEventArgs.cs
- RealProxy.cs
- BevelBitmapEffect.cs
- Geometry3D.cs
- SamlAssertionKeyIdentifierClause.cs
- ListContractAdapter.cs
- AdvancedBindingPropertyDescriptor.cs
- CheckBox.cs
- Attributes.cs
- TdsParserHelperClasses.cs
- ImmutablePropertyDescriptorGridEntry.cs
- RSAPKCS1KeyExchangeFormatter.cs
- PropertyChangedEventArgs.cs
- ExtenderProvidedPropertyAttribute.cs
- BookmarkUndoUnit.cs
- configsystem.cs
- EventRouteFactory.cs
- DbProviderFactoriesConfigurationHandler.cs
- LayoutManager.cs
- PriorityBindingExpression.cs
- DataGridViewCellStyleConverter.cs
- TypographyProperties.cs
- Vector3DValueSerializer.cs
- ScrollableControl.cs
- StrongName.cs
- ConditionCollection.cs
- OledbConnectionStringbuilder.cs
- CodeNamespaceImportCollection.cs
- EntityKey.cs
- Interlocked.cs
- XhtmlConformanceSection.cs
- AudioFileOut.cs
- TabControl.cs
- EarlyBoundInfo.cs
- DesignerHierarchicalDataSourceView.cs
- SoapAttributeOverrides.cs
- PlacementWorkspace.cs
- Table.cs