Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- CachedCompositeFamily.cs
- DeferredElementTreeState.cs
- XmlQualifiedName.cs
- FacetValueContainer.cs
- Path.cs
- XMLUtil.cs
- ZipFileInfoCollection.cs
- Helpers.cs
- InputMethod.cs
- BaseParser.cs
- Graphics.cs
- EncryptedReference.cs
- IEnumerable.cs
- SqlUtils.cs
- ExpiredSecurityTokenException.cs
- FolderNameEditor.cs
- QueryReaderSettings.cs
- ChineseLunisolarCalendar.cs
- MulticastNotSupportedException.cs
- AttachedPropertyMethodSelector.cs
- TextBlockAutomationPeer.cs
- StylusLogic.cs
- WebPartManagerInternals.cs
- KeyedHashAlgorithm.cs
- Geometry3D.cs
- IntellisenseTextBox.designer.cs
- QilStrConcatenator.cs
- PhonemeConverter.cs
- RequestSecurityToken.cs
- HtmlHead.cs
- MessageDroppedTraceRecord.cs
- ContextQuery.cs
- ProcessHostConfigUtils.cs
- SqlCommandSet.cs
- InstalledFontCollection.cs
- SqlConnectionManager.cs
- SafeArrayRankMismatchException.cs
- SamlAttribute.cs
- ObfuscateAssemblyAttribute.cs
- XmlSerializerAssemblyAttribute.cs
- DefaultTextStoreTextComposition.cs
- CurrencyManager.cs
- MessageBox.cs
- QueryIntervalOp.cs
- ObjectDataSourceChooseTypePanel.cs
- DtrList.cs
- VersionValidator.cs
- ResizeGrip.cs
- DataGridCaption.cs
- ListItemViewAttribute.cs
- ChangePassword.cs
- AspCompat.cs
- InstanceNotReadyException.cs
- ResourceReferenceExpression.cs
- FileDialogPermission.cs
- listitem.cs
- WebPartManagerInternals.cs
- Bits.cs
- XsdBuildProvider.cs
- SqlLiftIndependentRowExpressions.cs
- SQLInt16.cs
- SchemaMapping.cs
- IdentityReference.cs
- GridViewRowCollection.cs
- CheckBoxBaseAdapter.cs
- AbsoluteQuery.cs
- MethodAccessException.cs
- ConfigXmlWhitespace.cs
- ScrollBarRenderer.cs
- CustomErrorsSectionWrapper.cs
- RSACryptoServiceProvider.cs
- ExpressionVisitorHelpers.cs
- GridViewEditEventArgs.cs
- ProjectedSlot.cs
- FileLevelControlBuilderAttribute.cs
- UnmanagedMemoryStreamWrapper.cs
- SynchronizedInputHelper.cs
- ListControlConvertEventArgs.cs
- ListViewItem.cs
- MenuItemStyle.cs
- X509Utils.cs
- COSERVERINFO.cs
- TreeNodeStyle.cs
- Substitution.cs
- TitleStyle.cs
- DefaultHttpHandler.cs
- LocalIdKeyIdentifierClause.cs
- PassportPrincipal.cs
- KoreanCalendar.cs
- InstanceDescriptor.cs
- IPEndPointCollection.cs
- XmlSchemaSimpleContentExtension.cs
- CheckBoxPopupAdapter.cs
- CommandTreeTypeHelper.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- StringFreezingAttribute.cs
- xamlnodes.cs
- DescendantBaseQuery.cs
- BindingMemberInfo.cs
- XsltArgumentList.cs