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
- xmlfixedPageInfo.cs
- DetailsView.cs
- ValidationHelper.cs
- Html32TextWriter.cs
- BrowserCapabilitiesFactory.cs
- UiaCoreTypesApi.cs
- CodeTryCatchFinallyStatement.cs
- ConfigurationSchemaErrors.cs
- ConfigXmlDocument.cs
- Viewport3DVisual.cs
- CngKey.cs
- GeometryConverter.cs
- MemberCollection.cs
- _BufferOffsetSize.cs
- Publisher.cs
- Padding.cs
- ModelProperty.cs
- PriorityBindingExpression.cs
- Aggregates.cs
- TextViewBase.cs
- PerformanceCounterPermissionAttribute.cs
- Rect3D.cs
- BulletChrome.cs
- CrossSiteScriptingValidation.cs
- GlobalItem.cs
- BinaryUtilClasses.cs
- XPathEmptyIterator.cs
- JpegBitmapDecoder.cs
- Rect3DValueSerializer.cs
- DescendantBaseQuery.cs
- WebPartVerbsEventArgs.cs
- LambdaCompiler.Binary.cs
- Shared.cs
- Descriptor.cs
- WebColorConverter.cs
- CoTaskMemSafeHandle.cs
- TextSegment.cs
- XPathNavigatorReader.cs
- FontWeightConverter.cs
- templategroup.cs
- PeerNameRegistration.cs
- CalendarButtonAutomationPeer.cs
- FormatConvertedBitmap.cs
- UInt16Storage.cs
- PageBreakRecord.cs
- SqlNodeAnnotations.cs
- BamlRecordHelper.cs
- DocumentOrderQuery.cs
- DataGridViewCellPaintingEventArgs.cs
- DictationGrammar.cs
- SqlCacheDependencySection.cs
- ListComponentEditorPage.cs
- formatter.cs
- MessageDecoder.cs
- ObjectDataSourceWizardForm.cs
- UIElementCollection.cs
- Unit.cs
- StylusPlugInCollection.cs
- coordinator.cs
- EventRouteFactory.cs
- PeekCompletedEventArgs.cs
- DomainLiteralReader.cs
- ISFClipboardData.cs
- SurrogateEncoder.cs
- ContentFilePart.cs
- SamlSubjectStatement.cs
- LeafCellTreeNode.cs
- CorrelationKey.cs
- UniqueID.cs
- FunctionQuery.cs
- SchemaLookupTable.cs
- RowUpdatingEventArgs.cs
- MetadataSet.cs
- SqlCharStream.cs
- OperationContractAttribute.cs
- SerialErrors.cs
- MailDefinition.cs
- DragDeltaEventArgs.cs
- NetworkAddressChange.cs
- ObjectQueryProvider.cs
- XmlElementAttributes.cs
- OleDbStruct.cs
- ViewCellSlot.cs
- SqlError.cs
- XmlBinaryWriter.cs
- ScriptReferenceEventArgs.cs
- BamlStream.cs
- ObjectListTitleAttribute.cs
- DataObjectPastingEventArgs.cs
- SafeMemoryMappedViewHandle.cs
- DocumentXmlWriter.cs
- TraceSection.cs
- SByte.cs
- XmlSerializerFactory.cs
- DiscoveryClientDocuments.cs
- DataContract.cs
- PrinterUnitConvert.cs
- ImageListImage.cs
- DrawingState.cs
- OpenFileDialog.cs