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
- RadioButtonAutomationPeer.cs
- BaseTemplateBuildProvider.cs
- DbParameterCollection.cs
- SmtpDateTime.cs
- IndexingContentUnit.cs
- Animatable.cs
- OracleRowUpdatingEventArgs.cs
- MSAANativeProvider.cs
- DirectoryObjectSecurity.cs
- SingleAnimation.cs
- APCustomTypeDescriptor.cs
- TextPattern.cs
- LineServicesRun.cs
- SqlRowUpdatedEvent.cs
- CqlIdentifiers.cs
- WorkflowTraceTransfer.cs
- XmlTextAttribute.cs
- RegexCaptureCollection.cs
- WindowPattern.cs
- SmtpFailedRecipientException.cs
- BuildResultCache.cs
- ShortcutKeysEditor.cs
- TimeSpanValidator.cs
- PtsHost.cs
- GenericAuthenticationEventArgs.cs
- DocumentViewer.cs
- BitVector32.cs
- SettingsPropertyValue.cs
- RSAPKCS1SignatureDeformatter.cs
- SignedXml.cs
- DocumentPageTextView.cs
- IImplicitResourceProvider.cs
- FontSource.cs
- ActiveDocumentEvent.cs
- DecimalConstantAttribute.cs
- WsdlInspector.cs
- DispatcherProcessingDisabled.cs
- XmlSchemaSimpleContentRestriction.cs
- SQLUtility.cs
- DPTypeDescriptorContext.cs
- DataGridViewRowsRemovedEventArgs.cs
- ClonableStack.cs
- WebPartEditorApplyVerb.cs
- OutputScopeManager.cs
- SectionXmlInfo.cs
- TextContainer.cs
- ComponentTray.cs
- GeometryHitTestResult.cs
- ComponentCollection.cs
- AdapterUtil.cs
- _ListenerResponseStream.cs
- Html32TextWriter.cs
- SystemParameters.cs
- DataSourceDescriptorCollection.cs
- ZipIOBlockManager.cs
- Blend.cs
- XPathSelectionIterator.cs
- DataBindingList.cs
- SmtpSection.cs
- SqlDataSourceCommandEventArgs.cs
- RecognizerInfo.cs
- PackWebResponse.cs
- NumericPagerField.cs
- ImageDrawing.cs
- NameTable.cs
- TransportSecurityBindingElement.cs
- WebPartAddingEventArgs.cs
- StorageTypeMapping.cs
- Expression.cs
- XpsFilter.cs
- FixedStringLookup.cs
- AppSecurityManager.cs
- AtlasWeb.Designer.cs
- ProvidePropertyAttribute.cs
- Guid.cs
- RegexRunnerFactory.cs
- RequestCache.cs
- NativeObjectSecurity.cs
- RelationalExpressions.cs
- BitmapEffectDrawing.cs
- CodeLabeledStatement.cs
- HttpApplicationFactory.cs
- OptimalTextSource.cs
- WeakEventTable.cs
- SectionUpdates.cs
- ComAdminWrapper.cs
- StandardToolWindows.cs
- _Semaphore.cs
- QilCloneVisitor.cs
- FixedBufferAttribute.cs
- DataViewSetting.cs
- AxisAngleRotation3D.cs
- SkewTransform.cs
- TypeRefElement.cs
- BitmapEffectGroup.cs
- LicenseManager.cs
- DPTypeDescriptorContext.cs
- WizardStepBase.cs
- ApplicationHost.cs
- ResourceManager.cs