Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / ReadOnlyDataSource.cs / 1305376 / 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
- DatePickerDateValidationErrorEventArgs.cs
- KeyValueSerializer.cs
- SystemKeyConverter.cs
- ImageListUtils.cs
- StaticResourceExtension.cs
- _IPv6Address.cs
- DataGridViewAccessibleObject.cs
- InputElement.cs
- SizeF.cs
- EventWaitHandleSecurity.cs
- ServiceBusyException.cs
- XmlHelper.cs
- MouseButton.cs
- MonikerProxyAttribute.cs
- ReflectionPermission.cs
- ServiceModelActivationSectionGroup.cs
- DataBindingCollection.cs
- ValidationEventArgs.cs
- BackgroundWorker.cs
- CacheSection.cs
- DataGridAutoFormat.cs
- DataGridPreparingCellForEditEventArgs.cs
- XmlSchemaGroupRef.cs
- NavigationPropertySingletonExpression.cs
- DeflateStream.cs
- CollectionViewProxy.cs
- CodeExpressionStatement.cs
- CodeTypeReference.cs
- ExpressionVisitor.cs
- OracleRowUpdatedEventArgs.cs
- DesignTimeParseData.cs
- CredentialSelector.cs
- Pkcs7Signer.cs
- ContextMenu.cs
- COM2PropertyPageUITypeConverter.cs
- XmlBaseWriter.cs
- PackageRelationshipCollection.cs
- OleDbInfoMessageEvent.cs
- MatchingStyle.cs
- IntegerValidatorAttribute.cs
- ListSourceHelper.cs
- DeriveBytes.cs
- QueryHandler.cs
- Vector3DAnimation.cs
- NTAccount.cs
- XsltLibrary.cs
- QualificationDataItem.cs
- TransformCollection.cs
- IconHelper.cs
- SimpleBitVector32.cs
- DataSetUtil.cs
- SwitchLevelAttribute.cs
- TypographyProperties.cs
- AssertFilter.cs
- CodeDOMUtility.cs
- JsonEnumDataContract.cs
- PlainXmlWriter.cs
- TransformationRules.cs
- CreateUserWizardStep.cs
- SimplePropertyEntry.cs
- DbDataReader.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- TextBox.cs
- AnonymousIdentificationSection.cs
- PeerInvitationResponse.cs
- X509CertificateClaimSet.cs
- ByteRangeDownloader.cs
- XmlSchemaObjectCollection.cs
- PackageRelationship.cs
- ConfigXmlComment.cs
- AppSecurityManager.cs
- TextServicesProperty.cs
- ColumnTypeConverter.cs
- ProviderConnectionPoint.cs
- DataControlFieldCell.cs
- IndependentlyAnimatedPropertyMetadata.cs
- DataTable.cs
- AppLevelCompilationSectionCache.cs
- EncryptedType.cs
- UniqueSet.cs
- X509Utils.cs
- CachedTypeface.cs
- SerializationStore.cs
- DemultiplexingClientMessageFormatter.cs
- DeploymentSectionCache.cs
- KeyValueConfigurationElement.cs
- Error.cs
- ButtonField.cs
- DependencySource.cs
- COM2FontConverter.cs
- MessageEncoder.cs
- CancellationTokenSource.cs
- AuthenticatedStream.cs
- RadioButtonStandardAdapter.cs
- ResourceProviderFactory.cs
- RootNamespaceAttribute.cs
- PlatformNotSupportedException.cs
- XmlObjectSerializerWriteContextComplex.cs
- ColorKeyFrameCollection.cs
- CryptoKeySecurity.cs