Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyDataSource.cs / 1305376 / 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
- Point3DConverter.cs
- MeasureItemEvent.cs
- OrderedDictionaryStateHelper.cs
- WebPartConnectionsConfigureVerb.cs
- TextCollapsingProperties.cs
- PropertyConverter.cs
- Win32KeyboardDevice.cs
- DataServiceQueryOfT.cs
- OleAutBinder.cs
- DSACryptoServiceProvider.cs
- HtmlWindowCollection.cs
- EncryptedPackage.cs
- HttpFileCollection.cs
- WebRequest.cs
- UriSection.cs
- LayoutInformation.cs
- RoamingStoreFileUtility.cs
- SimpleType.cs
- StylusPointProperties.cs
- EnvironmentPermission.cs
- WebPartUserCapability.cs
- MouseButtonEventArgs.cs
- DataGridViewAdvancedBorderStyle.cs
- CustomTypeDescriptor.cs
- UnionExpr.cs
- SimpleBitVector32.cs
- KeyPullup.cs
- CursorConverter.cs
- XmlBaseReader.cs
- XmlSchemaObjectTable.cs
- TypefaceMetricsCache.cs
- CngAlgorithmGroup.cs
- WebBrowser.cs
- UmAlQuraCalendar.cs
- RuntimeConfigurationRecord.cs
- ThreadStaticAttribute.cs
- CompressionTransform.cs
- PeerNameResolver.cs
- EmptyQuery.cs
- StubHelpers.cs
- Polygon.cs
- PackUriHelper.cs
- XPathNavigator.cs
- BaseValidator.cs
- reliableinputsessionchannel.cs
- WindowsToolbarItemAsMenuItem.cs
- HwndKeyboardInputProvider.cs
- ObjectDataSourceDesigner.cs
- SelectionItemProviderWrapper.cs
- PageContent.cs
- PanningMessageFilter.cs
- RectangleGeometry.cs
- DataGridLinkButton.cs
- FlowPosition.cs
- ProtocolsConfigurationHandler.cs
- XmlObjectSerializerWriteContextComplex.cs
- KerberosReceiverSecurityToken.cs
- infer.cs
- PageAction.cs
- DoubleCollection.cs
- ActiveXContainer.cs
- WindowInteropHelper.cs
- FileSystemEnumerable.cs
- UInt32Storage.cs
- DesignerActionHeaderItem.cs
- CharacterBufferReference.cs
- WorkflowIdleBehavior.cs
- InheritanceContextHelper.cs
- EarlyBoundInfo.cs
- ServiceParser.cs
- WorkflowHostingResponseContext.cs
- BamlTreeMap.cs
- ClientConvert.cs
- Cursors.cs
- EventKeyword.cs
- DbConnectionPoolIdentity.cs
- SimpleHandlerBuildProvider.cs
- ProfileManager.cs
- FormatException.cs
- RelationshipEnd.cs
- TableColumn.cs
- QueryAccessibilityHelpEvent.cs
- Literal.cs
- Site.cs
- SetterBaseCollection.cs
- IndependentlyAnimatedPropertyMetadata.cs
- BrowserDefinitionCollection.cs
- PatternMatcher.cs
- FixedStringLookup.cs
- TypeInitializationException.cs
- SHA1.cs
- VersionConverter.cs
- SignatureSummaryDialog.cs
- LinqDataSourceDisposeEventArgs.cs
- SqlParameter.cs
- TableLayoutSettingsTypeConverter.cs
- WmlListAdapter.cs
- DbProviderFactoriesConfigurationHandler.cs
- SQLRoleProvider.cs
- RenderDataDrawingContext.cs