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
- MetadataPropertyCollection.cs
- SoapFault.cs
- UriTemplateMatchException.cs
- IriParsingElement.cs
- ShaderEffect.cs
- CompositeTypefaceMetrics.cs
- Merger.cs
- ValueOfAction.cs
- XmlSchemaAttributeGroup.cs
- NameTable.cs
- CapacityStreamGeometryContext.cs
- ReaderWriterLockSlim.cs
- SoapServerProtocol.cs
- PropertyGrid.cs
- DataGridCellClipboardEventArgs.cs
- SourceFilter.cs
- ProtocolViolationException.cs
- DetailsViewRowCollection.cs
- LowerCaseStringConverter.cs
- BrowserDefinitionCollection.cs
- PreservationFileWriter.cs
- Tool.cs
- XmlSerializationGeneratedCode.cs
- DateTimeOffsetAdapter.cs
- TreeViewAutomationPeer.cs
- RenderDataDrawingContext.cs
- OutputWindow.cs
- CodeGotoStatement.cs
- BitmapEffect.cs
- BindingExpression.cs
- DataObjectPastingEventArgs.cs
- _NegoState.cs
- SHA1CryptoServiceProvider.cs
- WebServiceClientProxyGenerator.cs
- JoinSymbol.cs
- ObjectItemAssemblyLoader.cs
- Bind.cs
- ProtocolInformationWriter.cs
- DispatcherEventArgs.cs
- SmiConnection.cs
- KeyValuePair.cs
- LinqDataSource.cs
- StateDesigner.Helpers.cs
- CombinedGeometry.cs
- CardSpaceException.cs
- AsyncContentLoadedEventArgs.cs
- KeyToListMap.cs
- Activator.cs
- DiscardableAttribute.cs
- EpmCustomContentSerializer.cs
- XmlCodeExporter.cs
- SqlDataSourceCommandParser.cs
- WebDisplayNameAttribute.cs
- ResizeBehavior.cs
- SqlOuterApplyReducer.cs
- StrongName.cs
- IntSumAggregationOperator.cs
- AccessDataSource.cs
- UnsettableComboBox.cs
- DataGridViewColumnConverter.cs
- WinFormsSpinner.cs
- HtmlTableRowCollection.cs
- TreeNodeConverter.cs
- SpotLight.cs
- DataServiceQueryProvider.cs
- __Filters.cs
- Attributes.cs
- MatrixTransform.cs
- GroupBox.cs
- RecordConverter.cs
- RawStylusSystemGestureInputReport.cs
- MethodBuilder.cs
- SqlProviderManifest.cs
- PixelShader.cs
- ServerProtocol.cs
- XmlSchemaResource.cs
- ToolStripGripRenderEventArgs.cs
- XmlLoader.cs
- Clipboard.cs
- CrossSiteScriptingValidation.cs
- GridEntryCollection.cs
- BitmapMetadataEnumerator.cs
- AvTrace.cs
- ServiceReference.cs
- QueryCacheManager.cs
- FormsAuthenticationTicket.cs
- PersonalizationStateInfo.cs
- webeventbuffer.cs
- Transform3DCollection.cs
- Descriptor.cs
- XamlDesignerSerializationManager.cs
- RegionInfo.cs
- HtmlInputPassword.cs
- ValueProviderWrapper.cs
- SQLByteStorage.cs
- PermissionSetEnumerator.cs
- SmiRecordBuffer.cs
- MemoryStream.cs
- InternalRelationshipCollection.cs
- TaskHelper.cs