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
- HostedTransportConfigurationBase.cs
- Pkcs7Recipient.cs
- ListViewItemMouseHoverEvent.cs
- BorderGapMaskConverter.cs
- odbcmetadatacollectionnames.cs
- GlyphShapingProperties.cs
- SpeechDetectedEventArgs.cs
- XmlAnyElementAttribute.cs
- SpinLock.cs
- MappingItemCollection.cs
- Size3DValueSerializer.cs
- ToolStripItemClickedEventArgs.cs
- TextEditorTables.cs
- Invariant.cs
- XmlSchemaObjectCollection.cs
- MetadataItemCollectionFactory.cs
- DNS.cs
- BackStopAuthenticationModule.cs
- DbProviderFactoriesConfigurationHandler.cs
- SByteStorage.cs
- RC2.cs
- ToolStripPanel.cs
- CodeExpressionCollection.cs
- ClientTargetSection.cs
- RichTextBoxAutomationPeer.cs
- Int32RectValueSerializer.cs
- DetailsViewCommandEventArgs.cs
- SharedConnectionWorkflowTransactionService.cs
- UIElementParagraph.cs
- ParseHttpDate.cs
- XmlSchemaNotation.cs
- HttpCachePolicy.cs
- SpanIndex.cs
- SafeTokenHandle.cs
- Boolean.cs
- SocketAddress.cs
- HideDisabledControlAdapter.cs
- VarRemapper.cs
- StorageInfo.cs
- x509store.cs
- AssociatedControlConverter.cs
- SecurityHeader.cs
- Style.cs
- recordstate.cs
- SqlInternalConnection.cs
- CodeConditionStatement.cs
- DataGridViewMethods.cs
- BatchStream.cs
- EnumerableValidator.cs
- Unit.cs
- Memoizer.cs
- NamedPipeTransportManager.cs
- EntityKey.cs
- MDIWindowDialog.cs
- WebPartManagerInternals.cs
- COAUTHIDENTITY.cs
- ArrayElementGridEntry.cs
- Roles.cs
- UrlEncodedParameterWriter.cs
- dsa.cs
- DesignerForm.cs
- ErrorFormatterPage.cs
- BehaviorEditorPart.cs
- Ref.cs
- BindUriHelper.cs
- FileAuthorizationModule.cs
- XamlWriter.cs
- ProfilePropertyNameValidator.cs
- OracleString.cs
- AnonymousIdentificationSection.cs
- DataSourceXmlSerializationAttribute.cs
- OverrideMode.cs
- Clause.cs
- StylusPlugin.cs
- PeerCollaborationPermission.cs
- TcpProcessProtocolHandler.cs
- XmlSchemaObjectCollection.cs
- ImageSourceTypeConverter.cs
- HttpModuleCollection.cs
- DropSourceBehavior.cs
- userdatakeys.cs
- TempEnvironment.cs
- NetworkCredential.cs
- XmlSchemaAppInfo.cs
- HitTestParameters3D.cs
- X509CertificateCollection.cs
- CacheSection.cs
- SafeReversePInvokeHandle.cs
- ScrollItemPattern.cs
- WmfPlaceableFileHeader.cs
- ChtmlTextWriter.cs
- SecurityTokenResolver.cs
- DataView.cs
- ComplexTypeEmitter.cs
- BindingElementCollection.cs
- InkCanvas.cs
- Debug.cs
- TextRange.cs
- ToolStripHighContrastRenderer.cs
- ExtensibleClassFactory.cs