Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SHA256Managed.cs
- RemoteCryptoRsaServiceProvider.cs
- DesignerActionListCollection.cs
- AttachedPropertyBrowsableAttribute.cs
- SinglePhaseEnlistment.cs
- DLinqAssociationProvider.cs
- ValueChangedEventManager.cs
- LongMinMaxAggregationOperator.cs
- BuilderPropertyEntry.cs
- ListViewGroup.cs
- InvalidPrinterException.cs
- Roles.cs
- CodeChecksumPragma.cs
- SimpleLine.cs
- QuotedPrintableStream.cs
- TextContainerChangeEventArgs.cs
- HtmlShim.cs
- ObjectDataSourceView.cs
- MimeMapping.cs
- COAUTHIDENTITY.cs
- ReadOnlyHierarchicalDataSource.cs
- SafeFindHandle.cs
- GACMembershipCondition.cs
- CalendarAutomationPeer.cs
- ApplicationBuildProvider.cs
- TimeSpanMinutesConverter.cs
- ExpandoClass.cs
- SafeNativeMethods.cs
- FrameAutomationPeer.cs
- ClipboardData.cs
- FixedTextBuilder.cs
- MaskedTextProvider.cs
- BlobPersonalizationState.cs
- LogEntryHeaderDeserializer.cs
- URLIdentityPermission.cs
- DbConnectionHelper.cs
- Size3D.cs
- ToolStripPanelRenderEventArgs.cs
- MsdtcWrapper.cs
- BigInt.cs
- latinshape.cs
- XPathNodeIterator.cs
- TreeNode.cs
- PolyBezierSegment.cs
- CSharpCodeProvider.cs
- PageBuildProvider.cs
- TemplatePartAttribute.cs
- XmlSerializerAssemblyAttribute.cs
- BrowserInteropHelper.cs
- FileLoadException.cs
- SplineKeyFrames.cs
- RepeatButton.cs
- EntityClassGenerator.cs
- DataBindingCollection.cs
- ZipIOModeEnforcingStream.cs
- LogAppendAsyncResult.cs
- TaskScheduler.cs
- LoadedEvent.cs
- RegexReplacement.cs
- DataGridState.cs
- HMACSHA512.cs
- ChooseAction.cs
- DependencyProperty.cs
- SessionIDManager.cs
- BuilderElements.cs
- DecoderFallback.cs
- TemplateParser.cs
- PtsPage.cs
- CriticalFinalizerObject.cs
- CreateCardRequest.cs
- JobDuplex.cs
- _ListenerAsyncResult.cs
- CodeNamespace.cs
- __Filters.cs
- SymbolEqualComparer.cs
- FontConverter.cs
- RoleManagerEventArgs.cs
- DataViewSetting.cs
- HotCommands.cs
- hresults.cs
- GetPageCompletedEventArgs.cs
- DispatcherEventArgs.cs
- figurelengthconverter.cs
- WhitespaceRuleLookup.cs
- HttpException.cs
- AuthorizationContext.cs
- XmlNamespaceMapping.cs
- DashStyles.cs
- Comparer.cs
- DateTimeOffset.cs
- GenericsInstances.cs
- SizeConverter.cs
- XmlnsCache.cs
- FunctionImportElement.cs
- SafeFindHandle.cs
- AtomServiceDocumentSerializer.cs
- ListSourceHelper.cs
- BridgeDataReader.cs
- ControlDesignerState.cs
- TypeListConverter.cs