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
- LassoSelectionBehavior.cs
- TextSelection.cs
- ScriptComponentDescriptor.cs
- PtsPage.cs
- XmlILStorageConverter.cs
- Processor.cs
- DateTimeUtil.cs
- MediaElement.cs
- DataControlLinkButton.cs
- TextEditorSelection.cs
- CategoriesDocumentFormatter.cs
- DataServiceQueryOfT.cs
- Soap.cs
- CfgSemanticTag.cs
- HwndSource.cs
- DynamicEndpoint.cs
- AxisAngleRotation3D.cs
- Table.cs
- MsmqAppDomainProtocolHandler.cs
- PerfService.cs
- XmlSchemaSubstitutionGroup.cs
- BasicExpressionVisitor.cs
- GlobalizationAssembly.cs
- ToolStripPanel.cs
- EmptyStringExpandableObjectConverter.cs
- RawAppCommandInputReport.cs
- ServicePointManagerElement.cs
- MessageSecurityOverTcp.cs
- SmtpNegotiateAuthenticationModule.cs
- FeatureSupport.cs
- DesignerView.Commands.cs
- PeerContact.cs
- ObjectAssociationEndMapping.cs
- UnauthorizedWebPart.cs
- TextRangeAdaptor.cs
- CustomMenuItemCollection.cs
- TranslateTransform.cs
- CqlWriter.cs
- DefinitionUpdate.cs
- PackageStore.cs
- SmtpFailedRecipientException.cs
- SafeFileMappingHandle.cs
- DataSourceControlBuilder.cs
- CompatibleComparer.cs
- PlainXmlDeserializer.cs
- MailWriter.cs
- AlignmentYValidation.cs
- DetailsViewPagerRow.cs
- ApplyTemplatesAction.cs
- AttachedProperty.cs
- DesignerCategoryAttribute.cs
- UnitySerializationHolder.cs
- SingleSelectRootGridEntry.cs
- FormViewInsertEventArgs.cs
- ZipPackagePart.cs
- EnumUnknown.cs
- LabelExpression.cs
- Vector.cs
- ActivityInstanceMap.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- DataConnectionHelper.cs
- TableLayoutSettingsTypeConverter.cs
- Mutex.cs
- FormViewInsertedEventArgs.cs
- TreeNodeBindingCollection.cs
- EdmComplexTypeAttribute.cs
- ComboBoxItem.cs
- CodeDomDesignerLoader.cs
- GenericEnumConverter.cs
- HighContrastHelper.cs
- BinHexDecoder.cs
- Barrier.cs
- CompositeControlDesigner.cs
- MemberPathMap.cs
- HostingEnvironmentSection.cs
- CSharpCodeProvider.cs
- TraceSection.cs
- SelectionWordBreaker.cs
- WebPartEditorApplyVerb.cs
- TypographyProperties.cs
- RepeatInfo.cs
- HandleCollector.cs
- DbConvert.cs
- Executor.cs
- ConfigurationStrings.cs
- NavigationPropertyEmitter.cs
- QilXmlReader.cs
- FontDriver.cs
- PropertyPushdownHelper.cs
- RpcAsyncResult.cs
- counter.cs
- XamlTemplateSerializer.cs
- BindUriHelper.cs
- COM2Properties.cs
- AutomationElementCollection.cs
- XPathPatternBuilder.cs
- LinkButton.cs
- SiteMapDataSourceView.cs
- DesignerSerializationVisibilityAttribute.cs
- SamlSerializer.cs