Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PathFigureCollection.cs
- StatusStrip.cs
- PropertyIDSet.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- DataListCommandEventArgs.cs
- TypeDependencyAttribute.cs
- UseLicense.cs
- Span.cs
- GeometryHitTestParameters.cs
- TimerElapsedEvenArgs.cs
- TagMapInfo.cs
- ChildTable.cs
- PrintController.cs
- LifetimeServices.cs
- PathParser.cs
- RtfToXamlLexer.cs
- _Win32.cs
- CompoundFileReference.cs
- ArrayItemReference.cs
- InstallerTypeAttribute.cs
- SqlCommandSet.cs
- BindingExpressionUncommonField.cs
- InvokeWebServiceDesigner.cs
- HMAC.cs
- UnsafeNativeMethodsMilCoreApi.cs
- webproxy.cs
- ModelVisual3D.cs
- EventListener.cs
- SrgsRuleRef.cs
- FormsAuthenticationConfiguration.cs
- FrameDimension.cs
- Calendar.cs
- UInt32.cs
- WebPartExportVerb.cs
- IconHelper.cs
- BoundPropertyEntry.cs
- CustomLineCap.cs
- EntityDataSourceMemberPath.cs
- Size.cs
- WinInetCache.cs
- XmlUTF8TextReader.cs
- SqlLiftWhereClauses.cs
- DSACryptoServiceProvider.cs
- FileInfo.cs
- ConfigXmlElement.cs
- ResourceDescriptionAttribute.cs
- UInt64Storage.cs
- DashStyle.cs
- UpdatePanelTriggerCollection.cs
- ControlValuePropertyAttribute.cs
- XPathQilFactory.cs
- Utils.cs
- BinaryReader.cs
- EditorPart.cs
- PolyQuadraticBezierSegment.cs
- RepeatButtonAutomationPeer.cs
- CollectionViewGroup.cs
- ListViewTableRow.cs
- MediaElementAutomationPeer.cs
- DataList.cs
- Model3D.cs
- BrowserPolicyValidator.cs
- InputMethod.cs
- CollectionViewSource.cs
- KernelTypeValidation.cs
- NavigateEvent.cs
- StorageBasedPackageProperties.cs
- SpecialNameAttribute.cs
- EncoderExceptionFallback.cs
- StylusOverProperty.cs
- TextLine.cs
- LinkLabelLinkClickedEvent.cs
- DisplayMemberTemplateSelector.cs
- StackOverflowException.cs
- BinaryFormatterWriter.cs
- SignedInfo.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- RawStylusSystemGestureInputReport.cs
- IisTraceListener.cs
- versioninfo.cs
- SQLString.cs
- CodeParameterDeclarationExpressionCollection.cs
- BinaryFormatterWriter.cs
- Keywords.cs
- AliasedSlot.cs
- SchemaElementLookUpTable.cs
- LiteralControl.cs
- SecurityState.cs
- MainMenu.cs
- LabelLiteral.cs
- HttpCapabilitiesSectionHandler.cs
- AppearanceEditorPart.cs
- Vars.cs
- sqlinternaltransaction.cs
- AnnotationAdorner.cs
- EncryptionUtility.cs
- FileVersionInfo.cs
- SettingsPropertyNotFoundException.cs
- DebugViewWriter.cs
- Profiler.cs