Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / DataSourceHelper.cs / 1 / DataSourceHelper.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Data; internal sealed class DataSourceHelper { private DataSourceHelper() { } internal static IEnumerable GetResolvedDataSource(object dataSource, string dataMember) { if (dataSource == null) return null; IListSource listSource = dataSource as IListSource; if (listSource != null) { IList memberList = listSource.GetList(); if (listSource.ContainsListCollection == false) { // the returned list is itself the list we need to bind to // return (IEnumerable)memberList; } if ((memberList != null) && (memberList is ITypedList)) { ITypedList typedMemberList = (ITypedList)memberList; PropertyDescriptorCollection propDescs = typedMemberList.GetItemProperties(new PropertyDescriptor[0]); if ((propDescs != null) && (propDescs.Count != 0)) { PropertyDescriptor listProperty = null; if (String.IsNullOrEmpty(dataMember)) { listProperty = propDescs[0]; } else { listProperty = propDescs.Find(dataMember, true); } if (listProperty != null) { object listRow = memberList[0]; object list = listProperty.GetValue(listRow); if ((list != null) && (list is IEnumerable)) { return (IEnumerable)list; } } throw new HttpException(SR.GetString(SR.ListSource_Missing_DataMember, dataMember)); } else { throw new HttpException(SR.GetString(SR.ListSource_Without_DataMembers)); } } } if (dataSource is IEnumerable) { return (IEnumerable)dataSource; } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI { using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.Data; internal sealed class DataSourceHelper { private DataSourceHelper() { } internal static IEnumerable GetResolvedDataSource(object dataSource, string dataMember) { if (dataSource == null) return null; IListSource listSource = dataSource as IListSource; if (listSource != null) { IList memberList = listSource.GetList(); if (listSource.ContainsListCollection == false) { // the returned list is itself the list we need to bind to // return (IEnumerable)memberList; } if ((memberList != null) && (memberList is ITypedList)) { ITypedList typedMemberList = (ITypedList)memberList; PropertyDescriptorCollection propDescs = typedMemberList.GetItemProperties(new PropertyDescriptor[0]); if ((propDescs != null) && (propDescs.Count != 0)) { PropertyDescriptor listProperty = null; if (String.IsNullOrEmpty(dataMember)) { listProperty = propDescs[0]; } else { listProperty = propDescs.Find(dataMember, true); } if (listProperty != null) { object listRow = memberList[0]; object list = listProperty.GetValue(listRow); if ((list != null) && (list is IEnumerable)) { return (IEnumerable)list; } } throw new HttpException(SR.GetString(SR.ListSource_Missing_DataMember, dataMember)); } else { throw new HttpException(SR.GetString(SR.ListSource_Without_DataMembers)); } } } if (dataSource is IEnumerable) { return (IEnumerable)dataSource; } return null; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- HealthMonitoringSection.cs
- SspiNegotiationTokenAuthenticator.cs
- WebBaseEventKeyComparer.cs
- PerformanceCounterManager.cs
- FloaterParagraph.cs
- UITypeEditor.cs
- ValidationErrorCollection.cs
- UIAgentAsyncBeginRequest.cs
- DeploymentExceptionMapper.cs
- DrawingVisualDrawingContext.cs
- ItemPager.cs
- RubberbandSelector.cs
- FeatureSupport.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- AuthenticationException.cs
- AsymmetricSignatureDeformatter.cs
- Splitter.cs
- FormViewDeletedEventArgs.cs
- ButtonBase.cs
- Funcletizer.cs
- TextStore.cs
- EventRoute.cs
- SecurityTokenContainer.cs
- Variable.cs
- SystemUnicastIPAddressInformation.cs
- KeyValuePair.cs
- HideDisabledControlAdapter.cs
- NonParentingControl.cs
- TracingConnectionListener.cs
- PrimaryKeyTypeConverter.cs
- FormsAuthenticationTicket.cs
- _ConnectStream.cs
- WebBrowserEvent.cs
- TreeViewBindingsEditor.cs
- DetailsViewModeEventArgs.cs
- PlacementWorkspace.cs
- securitymgrsite.cs
- SaveLedgerEntryRequest.cs
- SecurityDescriptor.cs
- FontConverter.cs
- MemberAccessException.cs
- PostBackTrigger.cs
- TextCompositionManager.cs
- GridViewUpdateEventArgs.cs
- SQLInt16.cs
- SyndicationItem.cs
- ManipulationDelta.cs
- HorizontalAlignConverter.cs
- DataSvcMapFile.cs
- FileDialog_Vista_Interop.cs
- ControlBindingsCollection.cs
- CompositeDataBoundControl.cs
- DescendantOverDescendantQuery.cs
- ParserStreamGeometryContext.cs
- ConsoleEntryPoint.cs
- DSASignatureDeformatter.cs
- Misc.cs
- AbandonedMutexException.cs
- TTSEngineTypes.cs
- ComponentEvent.cs
- elementinformation.cs
- WmpBitmapEncoder.cs
- LOSFormatter.cs
- HostSecurityManager.cs
- HttpCachePolicyElement.cs
- BindableTemplateBuilder.cs
- ListBoxItemWrapperAutomationPeer.cs
- ThicknessAnimationBase.cs
- RubberbandSelector.cs
- OleDbTransaction.cs
- StorageMappingFragment.cs
- EventLogPermission.cs
- StackOverflowException.cs
- TableLayoutStyleCollection.cs
- DefaultValidator.cs
- XmlMembersMapping.cs
- ConnectionsZone.cs
- OdbcInfoMessageEvent.cs
- ADRole.cs
- HybridWebProxyFinder.cs
- HttpChannelHelper.cs
- Int32AnimationBase.cs
- XmlAnyElementAttributes.cs
- HostedTransportConfigurationManager.cs
- EditingCoordinator.cs
- Cursor.cs
- Rijndael.cs
- FontCacheUtil.cs
- UpdatePanelControlTrigger.cs
- DefaultParameterValueAttribute.cs
- ThousandthOfEmRealPoints.cs
- ISAPIWorkerRequest.cs
- InternalMappingException.cs
- BoundPropertyEntry.cs
- HyperLink.cs
- HttpRuntime.cs
- Span.cs
- BinaryNode.cs
- ProcessProtocolHandler.cs
- LogPolicy.cs