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
- DependencyPropertyKey.cs
- GeneralTransform3DCollection.cs
- PLINQETWProvider.cs
- FlowDocumentPageViewerAutomationPeer.cs
- NetNamedPipeBindingCollectionElement.cs
- WindowsListViewGroup.cs
- DynamicEndpointElement.cs
- RootDesignerSerializerAttribute.cs
- HMACMD5.cs
- CommandPlan.cs
- GridViewColumnHeader.cs
- SoapMessage.cs
- GeneralTransform.cs
- SqlDataSourceEnumerator.cs
- PropertyTab.cs
- DataGrid.cs
- ItemMap.cs
- MembershipSection.cs
- SectionVisual.cs
- HtmlHead.cs
- XmlStreamNodeWriter.cs
- CurrentChangedEventManager.cs
- CompressionTransform.cs
- CaseInsensitiveOrdinalStringComparer.cs
- ArithmeticLiteral.cs
- XmlSchema.cs
- DesignerTransactionCloseEvent.cs
- FormViewInsertEventArgs.cs
- SerialErrors.cs
- SecurityPermission.cs
- XmlAttributeProperties.cs
- Avt.cs
- KnownIds.cs
- OleDbStruct.cs
- WriteTimeStream.cs
- KeyInterop.cs
- lengthconverter.cs
- WebBrowserEvent.cs
- ViewEvent.cs
- ParameterElementCollection.cs
- Imaging.cs
- ConditionalAttribute.cs
- ReliabilityContractAttribute.cs
- UnionCodeGroup.cs
- SqlDataRecord.cs
- BitSet.cs
- UIElementPropertyUndoUnit.cs
- SequentialWorkflowHeaderFooter.cs
- Exceptions.cs
- DeviceFiltersSection.cs
- XmlSchemaSimpleType.cs
- MailWebEventProvider.cs
- TypeConverterHelper.cs
- WorkflowMessageEventArgs.cs
- DurableInstancingOptions.cs
- CompositeClientFormatter.cs
- WebPartDeleteVerb.cs
- DataGridColumnHeadersPresenter.cs
- Parameter.cs
- GroupLabel.cs
- ToolStripPanelRenderEventArgs.cs
- CurrencyWrapper.cs
- Model3DGroup.cs
- ButtonAutomationPeer.cs
- SimpleLine.cs
- FileCodeGroup.cs
- FontWeightConverter.cs
- DesignerCategoryAttribute.cs
- ElementMarkupObject.cs
- TypeGenericEnumerableViewSchema.cs
- SqlDependencyListener.cs
- FlowDocument.cs
- Annotation.cs
- WriterOutput.cs
- LowerCaseStringConverter.cs
- DbProviderFactoriesConfigurationHandler.cs
- ApplicationInterop.cs
- DateRangeEvent.cs
- CacheChildrenQuery.cs
- QilFactory.cs
- MailAddressParser.cs
- ChannelHandler.cs
- DockingAttribute.cs
- DockAndAnchorLayout.cs
- Ray3DHitTestResult.cs
- ListenerElementsCollection.cs
- ResourceDictionary.cs
- MethodExpr.cs
- ControlParameter.cs
- DependencyObjectPropertyDescriptor.cs
- ButtonChrome.cs
- MenuAutomationPeer.cs
- DefinitionProperties.cs
- TextElementAutomationPeer.cs
- StickyNoteContentControl.cs
- CacheDict.cs
- EncodingDataItem.cs
- OleServicesContext.cs
- Config.cs
- UseManagedPresentationElement.cs