Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //----------------------------------------------------------------------------- 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
- HotSpot.cs
- XhtmlBasicImageAdapter.cs
- EditorAttribute.cs
- DataGridCommandEventArgs.cs
- DesignerDataTableBase.cs
- ClickablePoint.cs
- BitmapEffectGroup.cs
- TwoPhaseCommitProxy.cs
- CmsInterop.cs
- glyphs.cs
- GeneralTransform3DGroup.cs
- ConfigurationElementProperty.cs
- TextElementCollectionHelper.cs
- ScrollBar.cs
- ListViewDataItem.cs
- HandlerFactoryWrapper.cs
- TableItemProviderWrapper.cs
- AnimationClockResource.cs
- EntityDataSourceDataSelectionPanel.cs
- DrawItemEvent.cs
- RemotingAttributes.cs
- CommunicationException.cs
- StringSorter.cs
- WebServiceData.cs
- ClosableStream.cs
- SrgsSemanticInterpretationTag.cs
- RecipientServiceModelSecurityTokenRequirement.cs
- DataGridViewButtonCell.cs
- KeyManager.cs
- Style.cs
- TextBlockAutomationPeer.cs
- BamlLocalizationDictionary.cs
- XmlExtensionFunction.cs
- SettingsPropertyIsReadOnlyException.cs
- Point.cs
- FontStretchConverter.cs
- FunctionDetailsReader.cs
- DataGridTableCollection.cs
- TextWriter.cs
- OuterGlowBitmapEffect.cs
- EdmRelationshipRoleAttribute.cs
- CategoryEditor.cs
- ConfigurationValidatorBase.cs
- NativeMethods.cs
- MultipleViewPattern.cs
- DefaultTextStore.cs
- SchemaReference.cs
- FilterRepeater.cs
- ComMethodElementCollection.cs
- EncryptedXml.cs
- XmlEntityReference.cs
- SudsCommon.cs
- Style.cs
- RelationshipConverter.cs
- AnnotationAdorner.cs
- ToolStripSettings.cs
- DaylightTime.cs
- ExceptionNotification.cs
- DbProviderSpecificTypePropertyAttribute.cs
- GroupLabel.cs
- StylusPointPropertyId.cs
- Permission.cs
- ObjectDataSourceView.cs
- LedgerEntry.cs
- Bitmap.cs
- XmlDataSourceDesigner.cs
- ExpressionVisitorHelpers.cs
- OleDbPermission.cs
- ButtonBase.cs
- GroupBoxRenderer.cs
- UserControl.cs
- DefaultShape.cs
- BitmapFrameDecode.cs
- hwndwrapper.cs
- CrossSiteScriptingValidation.cs
- Vector3DKeyFrameCollection.cs
- TypeForwardedToAttribute.cs
- Attachment.cs
- RunClient.cs
- ExtenderControl.cs
- StrongNameUtility.cs
- SQLBytesStorage.cs
- AspNetHostingPermission.cs
- ArraySortHelper.cs
- Formatter.cs
- ASCIIEncoding.cs
- BinaryFormatter.cs
- QueryIntervalOp.cs
- FileSystemEventArgs.cs
- SecureEnvironment.cs
- DescendantQuery.cs
- UserNameSecurityTokenAuthenticator.cs
- PolyBezierSegmentFigureLogic.cs
- PageHandlerFactory.cs
- LinqDataSourceDeleteEventArgs.cs
- Quad.cs
- CellTreeNodeVisitors.cs
- PageSettings.cs
- DataContractJsonSerializer.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs