Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / DynamicData / DynamicData / ModelProviders / SimpleTableProvider.cs / 1305376 / SimpleTableProvider.cs
namespace System.Web.DynamicData.ModelProviders { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.ObjectModel; using System.ComponentModel; internal sealed class SimpleTableProvider : TableProvider { private List_columns; private ICustomTypeDescriptor _descriptor; public SimpleTableProvider(DataModelProvider modelProvider, Type entityType) : base(modelProvider) { if (entityType == null) { throw new ArgumentNullException("entityType"); } EntityType = entityType; Name = entityType.Name; DataContextPropertyName = String.Empty; InitializeColumns(TypeDescriptor.GetProperties(entityType)); } public SimpleTableProvider(DataModelProvider modelProvider, ICustomTypeDescriptor descriptor) : base(modelProvider) { if (descriptor == null) { throw new ArgumentNullException("descriptor"); } _descriptor = descriptor; Name = descriptor.GetClassName(); DataContextPropertyName = String.Empty; InitializeColumns(descriptor.GetProperties()); } public override ReadOnlyCollection Columns { get { return _columns.AsReadOnly(); } } public override ICustomTypeDescriptor GetTypeDescriptor() { return _descriptor ?? base.GetTypeDescriptor(); } public override IQueryable GetQuery(object context) { throw new NotSupportedException(); } private void InitializeColumns(PropertyDescriptorCollection columnDescriptors) { _columns = columnDescriptors.OfType ().Select(p => new SimpleColumnProvider(this, p)).OfType ().ToList(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Web.DynamicData.ModelProviders { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.ObjectModel; using System.ComponentModel; internal sealed class SimpleTableProvider : TableProvider { private List _columns; private ICustomTypeDescriptor _descriptor; public SimpleTableProvider(DataModelProvider modelProvider, Type entityType) : base(modelProvider) { if (entityType == null) { throw new ArgumentNullException("entityType"); } EntityType = entityType; Name = entityType.Name; DataContextPropertyName = String.Empty; InitializeColumns(TypeDescriptor.GetProperties(entityType)); } public SimpleTableProvider(DataModelProvider modelProvider, ICustomTypeDescriptor descriptor) : base(modelProvider) { if (descriptor == null) { throw new ArgumentNullException("descriptor"); } _descriptor = descriptor; Name = descriptor.GetClassName(); DataContextPropertyName = String.Empty; InitializeColumns(descriptor.GetProperties()); } public override ReadOnlyCollection Columns { get { return _columns.AsReadOnly(); } } public override ICustomTypeDescriptor GetTypeDescriptor() { return _descriptor ?? base.GetTypeDescriptor(); } public override IQueryable GetQuery(object context) { throw new NotSupportedException(); } private void InitializeColumns(PropertyDescriptorCollection columnDescriptors) { _columns = columnDescriptors.OfType ().Select(p => new SimpleColumnProvider(this, p)).OfType ().ToList(); } } } // 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
- WrappedIUnknown.cs
- DetailsViewPageEventArgs.cs
- UITypeEditors.cs
- OleDbStruct.cs
- FixedSOMElement.cs
- FlowDocumentReader.cs
- FullTextLine.cs
- ServiceContractGenerationContext.cs
- RelativeSource.cs
- CodeTryCatchFinallyStatement.cs
- METAHEADER.cs
- Matrix3D.cs
- NetCodeGroup.cs
- BamlTreeUpdater.cs
- XmlILAnnotation.cs
- _emptywebproxy.cs
- HostingEnvironmentException.cs
- _HTTPDateParse.cs
- ScalarType.cs
- TypeReference.cs
- DeflateInput.cs
- BindingsCollection.cs
- ParallelTimeline.cs
- LinqDataSourceStatusEventArgs.cs
- TaskHelper.cs
- MenuStrip.cs
- BStrWrapper.cs
- WorkerRequest.cs
- SafeLocalMemHandle.cs
- UnsupportedPolicyOptionsException.cs
- OdbcTransaction.cs
- SafeNativeMethods.cs
- XmlNavigatorFilter.cs
- StatusBarItemAutomationPeer.cs
- WsdlHelpGeneratorElement.cs
- PrePostDescendentsWalker.cs
- UIElement3D.cs
- Thread.cs
- LocalBuilder.cs
- EventArgs.cs
- ExpandCollapsePattern.cs
- TypeConverterAttribute.cs
- GeneralTransform3DGroup.cs
- StylusEditingBehavior.cs
- Root.cs
- XmlNodeComparer.cs
- CellRelation.cs
- TextTrailingWordEllipsis.cs
- HMACSHA512.cs
- DbConnectionInternal.cs
- ModelUIElement3D.cs
- SecurityHelper.cs
- SpellerError.cs
- MultiplexingDispatchMessageFormatter.cs
- TextDecorationCollectionConverter.cs
- XmlEncoding.cs
- Lasso.cs
- DataTableMappingCollection.cs
- MetadataProperty.cs
- HttpCookieCollection.cs
- ExceptionValidationRule.cs
- Pts.cs
- WindowsAuthenticationEventArgs.cs
- ViewCellRelation.cs
- FormsAuthenticationUserCollection.cs
- ParseChildrenAsPropertiesAttribute.cs
- Timer.cs
- CachedFontFamily.cs
- SubpageParagraph.cs
- ReachFixedDocumentSerializer.cs
- ListViewContainer.cs
- BooleanSwitch.cs
- ViewgenContext.cs
- ErrorView.xaml.cs
- diagnosticsswitches.cs
- HiddenFieldDesigner.cs
- TreeIterators.cs
- XmlSchemaChoice.cs
- Light.cs
- WindowsFont.cs
- ByeMessageCD1.cs
- SmiMetaData.cs
- EntityCodeGenerator.cs
- HttpCookieCollection.cs
- WpfKnownMemberInvoker.cs
- SspiNegotiationTokenProvider.cs
- EpmSourceTree.cs
- KeyTime.cs
- CodeTypeOfExpression.cs
- SetIterators.cs
- ComPersistableTypeElement.cs
- GAC.cs
- MissingSatelliteAssemblyException.cs
- SwitchAttribute.cs
- x509utils.cs
- TemplateControl.cs
- TimeSpanConverter.cs
- DockAndAnchorLayout.cs
- ByteAnimationBase.cs
- HttpCacheVary.cs