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
- XsltConvert.cs
- RectAnimation.cs
- DecimalConstantAttribute.cs
- Assembly.cs
- DbProviderSpecificTypePropertyAttribute.cs
- DecoratedNameAttribute.cs
- NumberFunctions.cs
- RelatedImageListAttribute.cs
- SemanticAnalyzer.cs
- FileEnumerator.cs
- BamlBinaryWriter.cs
- Highlights.cs
- ComPlusServiceLoader.cs
- FixedElement.cs
- OracleCommandBuilder.cs
- UIElement3D.cs
- ServiceChannel.cs
- SystemIPInterfaceProperties.cs
- BulletDecorator.cs
- UInt64Converter.cs
- CompoundFileStorageReference.cs
- RawKeyboardInputReport.cs
- DataGridSortCommandEventArgs.cs
- Stack.cs
- ModifiableIteratorCollection.cs
- XmlImplementation.cs
- ISAPIRuntime.cs
- MarkupCompilePass2.cs
- ParserOptions.cs
- SafeLibraryHandle.cs
- MenuItemCollectionEditor.cs
- ColumnProvider.cs
- TextTreeTextElementNode.cs
- Model3DGroup.cs
- JsonDeserializer.cs
- UnsignedPublishLicense.cs
- CalendarItem.cs
- RunWorkerCompletedEventArgs.cs
- WindowsToolbarAsMenu.cs
- TextTreeExtractElementUndoUnit.cs
- SchemaElementDecl.cs
- SchemaEntity.cs
- CodeIdentifiers.cs
- IsolatedStorageFile.cs
- UniqueID.cs
- TreeNodeEventArgs.cs
- AppModelKnownContentFactory.cs
- XPathNode.cs
- MDIControlStrip.cs
- ThreadLocal.cs
- ValueTypeFixupInfo.cs
- KeyValueConfigurationElement.cs
- ResourceProviderFactory.cs
- EncryptedPackage.cs
- EndpointInstanceProvider.cs
- ReadOnlyCollectionBase.cs
- TextLine.cs
- NCryptNative.cs
- COMException.cs
- ClientData.cs
- GenericWebPart.cs
- EventLogStatus.cs
- Label.cs
- WsdlInspector.cs
- WebPartManager.cs
- SizeKeyFrameCollection.cs
- RepeaterItem.cs
- SqlFormatter.cs
- XPathDocumentBuilder.cs
- BindingMAnagerBase.cs
- ConnectionManagementSection.cs
- ResourceManager.cs
- AtomServiceDocumentSerializer.cs
- Int32Storage.cs
- ResourceDisplayNameAttribute.cs
- PointAnimationUsingKeyFrames.cs
- SessionEndedEventArgs.cs
- DragEvent.cs
- EmissiveMaterial.cs
- GuidelineSet.cs
- ViewUtilities.cs
- ConnectionPool.cs
- LineMetrics.cs
- ViewSimplifier.cs
- IssuerInformation.cs
- UIElementHelper.cs
- CompoundFileStorageReference.cs
- RegionInfo.cs
- MouseGesture.cs
- ObjectViewEntityCollectionData.cs
- VirtualPath.cs
- MarkupWriter.cs
- StyleHelper.cs
- OAVariantLib.cs
- DataServiceRequestOfT.cs
- TreeNodeEventArgs.cs
- ModuleElement.cs
- TemplateControlCodeDomTreeGenerator.cs
- DataGridTable.cs
- login.cs