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
- MessagePartSpecification.cs
- securestring.cs
- ListMarkerLine.cs
- Group.cs
- ListDataBindEventArgs.cs
- StringFormat.cs
- ContentValidator.cs
- Int32KeyFrameCollection.cs
- NonBatchDirectoryCompiler.cs
- OdbcEnvironment.cs
- TableLayoutSettings.cs
- BoundColumn.cs
- BamlBinaryReader.cs
- StrokeNodeOperations2.cs
- SimpleLine.cs
- odbcmetadatafactory.cs
- ForeignKeyConstraint.cs
- WindowsRichEdit.cs
- EventWaitHandle.cs
- ConfigurationValue.cs
- MimePart.cs
- HttpConfigurationSystem.cs
- TextRangeProviderWrapper.cs
- Thickness.cs
- Comparer.cs
- CalendarAutoFormatDialog.cs
- AssociationTypeEmitter.cs
- NativeMethodsOther.cs
- HitTestParameters3D.cs
- EntityDesignerUtils.cs
- TrackingStringDictionary.cs
- TokenFactoryCredential.cs
- _RequestCacheProtocol.cs
- DocumentSchemaValidator.cs
- LassoSelectionBehavior.cs
- DefaultSerializationProviderAttribute.cs
- SurrogateSelector.cs
- IxmlLineInfo.cs
- RtfToXamlLexer.cs
- HtmlForm.cs
- XPathPatternBuilder.cs
- FixedDSBuilder.cs
- SafeNativeMethods.cs
- Int32.cs
- DoubleCollection.cs
- PolyBezierSegment.cs
- SerTrace.cs
- XamlStream.cs
- TargetInvocationException.cs
- QuotedPrintableStream.cs
- RetrieveVirtualItemEventArgs.cs
- EntityUtil.cs
- Pipe.cs
- PartitionResolver.cs
- HtmlButton.cs
- ImageUrlEditor.cs
- XmlUrlEditor.cs
- MembershipSection.cs
- TableHeaderCell.cs
- DataRecord.cs
- TextEndOfLine.cs
- TemplateApplicationHelper.cs
- HTMLTagNameToTypeMapper.cs
- XPathNodePointer.cs
- TextRangeEditTables.cs
- ConfigXmlElement.cs
- DocumentReferenceCollection.cs
- AutoFocusStyle.xaml.cs
- ControlEvent.cs
- SemaphoreSecurity.cs
- ContentDisposition.cs
- XmlSerializerNamespaces.cs
- HealthMonitoringSectionHelper.cs
- bidPrivateBase.cs
- DataGridViewElement.cs
- _AutoWebProxyScriptWrapper.cs
- FormattedTextSymbols.cs
- OLEDB_Enum.cs
- PerspectiveCamera.cs
- PrintController.cs
- ObjectSecurity.cs
- DBPropSet.cs
- SHA256CryptoServiceProvider.cs
- DesignerTransactionCloseEvent.cs
- FrugalList.cs
- WorkflowControlEndpoint.cs
- TemplateNameScope.cs
- TraceRecord.cs
- BreakSafeBase.cs
- DefaultEventAttribute.cs
- StringAnimationBase.cs
- ProvidePropertyAttribute.cs
- CharacterMetricsDictionary.cs
- XmlExtensionFunction.cs
- TransformerInfoCollection.cs
- PropertyCondition.cs
- TimeSpanFormat.cs
- HttpUnhandledOperationInvoker.cs
- RangeValidator.cs
- HMACMD5.cs