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
- Style.cs
- ItemsChangedEventArgs.cs
- Invariant.cs
- AssemblyName.cs
- TypeDescriptionProviderAttribute.cs
- CustomErrorCollection.cs
- DynamicPropertyReader.cs
- DataGridViewColumnEventArgs.cs
- OdbcParameter.cs
- Compress.cs
- WebPartChrome.cs
- COM2EnumConverter.cs
- ConfigurationFileMap.cs
- SponsorHelper.cs
- BoolLiteral.cs
- StartUpEventArgs.cs
- Accessible.cs
- SerializeAbsoluteContext.cs
- selecteditemcollection.cs
- DefinitionBase.cs
- PropertyPathWorker.cs
- unsafenativemethodsother.cs
- DbProviderFactory.cs
- EnumValidator.cs
- SoapIgnoreAttribute.cs
- ObjectParameter.cs
- EndpointAddressAugust2004.cs
- SharedPersonalizationStateInfo.cs
- ToolStripLabel.cs
- DCSafeHandle.cs
- StylusButtonEventArgs.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- QueryCacheManager.cs
- TextTreeRootNode.cs
- DropShadowBitmapEffect.cs
- BitmapFrame.cs
- WebPartTransformerCollection.cs
- NotifyParentPropertyAttribute.cs
- XmlConvert.cs
- Vector3D.cs
- BitmapEffectDrawingContent.cs
- CornerRadiusConverter.cs
- BinaryMessageFormatter.cs
- TypeConverterAttribute.cs
- SecurityIdentifierConverter.cs
- Model3D.cs
- SqlInternalConnectionSmi.cs
- ProjectionRewriter.cs
- SubstitutionResponseElement.cs
- MsdtcClusterUtils.cs
- UnicastIPAddressInformationCollection.cs
- AppSettingsExpressionBuilder.cs
- AssemblyAttributesGoHere.cs
- Accessible.cs
- WebHttpBinding.cs
- RegexCompiler.cs
- DisplayInformation.cs
- MultipleViewProviderWrapper.cs
- RenderingBiasValidation.cs
- GPRECTF.cs
- SettingsSection.cs
- SpotLight.cs
- HitTestResult.cs
- TranslateTransform.cs
- Viewport3DVisual.cs
- MsmqIntegrationBinding.cs
- DispatcherEventArgs.cs
- DataBindingCollection.cs
- Addressing.cs
- XPathQilFactory.cs
- XmlSchemaProviderAttribute.cs
- TypeExtensionConverter.cs
- DrawToolTipEventArgs.cs
- DCSafeHandle.cs
- ListViewSortEventArgs.cs
- util.cs
- SQLInt64Storage.cs
- xml.cs
- VirtualStackFrame.cs
- ControlPaint.cs
- SectionVisual.cs
- DesignTimeParseData.cs
- SizeLimitedCache.cs
- StylusDevice.cs
- ControlBindingsCollection.cs
- DocumentPageViewAutomationPeer.cs
- Byte.cs
- PrintingPermissionAttribute.cs
- CheckBoxPopupAdapter.cs
- CriticalFinalizerObject.cs
- IdentityHolder.cs
- FieldMetadata.cs
- ProfileGroupSettingsCollection.cs
- PriorityBinding.cs
- VBCodeProvider.cs
- EasingKeyFrames.cs
- ReachUIElementCollectionSerializer.cs
- BinarySerializer.cs
- AttributeCollection.cs
- ResourcesBuildProvider.cs