Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / BaseTypeViewSchema.cs / 1 / BaseTypeViewSchema.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI.Design {
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
///
/// Represents a view's schema based on a Type object retrieved
/// through Reflection. This is the base class for several view schema
/// types.
///
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, Flags = System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]
internal abstract class BaseTypeViewSchema : IDataSourceViewSchema {
private Type _type;
private string _viewName;
protected BaseTypeViewSchema(string viewName, Type type) {
Debug.Assert(type != null);
_type = type;
_viewName = viewName;
}
public IDataSourceFieldSchema[] GetFields() {
// Search for indexer property
System.Collections.Generic.List fields = new System.Collections.Generic.List();
Type rowType = GetRowType(_type);
if (rowType != null) {
// We specifically don't get schema when the type implements
// ICustomTypeDescriptor since it is unlikely to have the
// correct schema at design time.
if (!typeof(ICustomTypeDescriptor).IsAssignableFrom(rowType)) {
PropertyDescriptorCollection rowProperties = TypeDescriptor.GetProperties(rowType);
foreach (PropertyDescriptor rowProperty in rowProperties) {
fields.Add(new TypeFieldSchema(rowProperty));
}
}
}
return fields.ToArray();
}
public IDataSourceViewSchema[] GetChildren() {
return null;
}
///
/// Derived classes must implement this method to retrieve the row
/// type for a given object types. For example, in a strongly typed
/// DataTable the row type would be the strongly typed DataRow.
///
protected abstract Type GetRowType(Type objectType);
public string Name {
get {
return _viewName;
}
}
}
}
// 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
- ObjectNavigationPropertyMapping.cs
- SecurityImpersonationBehavior.cs
- ConstructorNeedsTagAttribute.cs
- basevalidator.cs
- DrawItemEvent.cs
- WebPartHeaderCloseVerb.cs
- XmlCollation.cs
- FixedHighlight.cs
- CheckPair.cs
- XmlDataImplementation.cs
- CodeLinePragma.cs
- ResourceAttributes.cs
- DataGridTable.cs
- WindowsPrincipal.cs
- ServiceNotStartedException.cs
- TextRangeBase.cs
- CacheDependency.cs
- AdapterDictionary.cs
- ResourceKey.cs
- BuildProvider.cs
- ArcSegment.cs
- FileNotFoundException.cs
- MarkupExtensionReturnTypeAttribute.cs
- IconBitmapDecoder.cs
- ParameterToken.cs
- ResourcesBuildProvider.cs
- Typography.cs
- RayMeshGeometry3DHitTestResult.cs
- figurelength.cs
- TypeBuilder.cs
- BaseTemplateBuildProvider.cs
- CodeGenerator.cs
- HtmlInputCheckBox.cs
- IPEndPointCollection.cs
- SpeechUI.cs
- DesignOnlyAttribute.cs
- SiteMapDataSourceView.cs
- DashStyles.cs
- EnumerableRowCollection.cs
- CollectionBase.cs
- XPathSelectionIterator.cs
- NotificationContext.cs
- Visual3D.cs
- COM2PropertyDescriptor.cs
- StylusPointPropertyInfoDefaults.cs
- NegationPusher.cs
- DocumentReferenceCollection.cs
- Delay.cs
- Utilities.cs
- ObjectDataSourceSelectingEventArgs.cs
- HideDisabledControlAdapter.cs
- RegistrySecurity.cs
- BooleanExpr.cs
- DateTime.cs
- ScriptingRoleServiceSection.cs
- SymmetricAlgorithm.cs
- TextSchema.cs
- CultureTableRecord.cs
- PromptEventArgs.cs
- mactripleDES.cs
- ItemList.cs
- Odbc32.cs
- SafeEventHandle.cs
- ScriptBehaviorDescriptor.cs
- embossbitmapeffect.cs
- XmlDataCollection.cs
- Dispatcher.cs
- ToolStripLabel.cs
- BidPrivateBase.cs
- CompleteWizardStep.cs
- RemoteWebConfigurationHostStream.cs
- TypeUtils.cs
- Int32CollectionValueSerializer.cs
- DataGridLinkButton.cs
- TreeViewEvent.cs
- DaylightTime.cs
- IsolatedStorageFilePermission.cs
- OpenTypeLayoutCache.cs
- HotSpotCollection.cs
- SignatureToken.cs
- linebase.cs
- ISAPIApplicationHost.cs
- IssuedTokenClientElement.cs
- TableCell.cs
- WhitespaceRule.cs
- SqlBinder.cs
- EffectiveValueEntry.cs
- EndpointAddressMessageFilter.cs
- AnnotationAuthorChangedEventArgs.cs
- ExeContext.cs
- SecurityTokenSpecification.cs
- Matrix3DValueSerializer.cs
- SqlDataSource.cs
- Font.cs
- Model3DGroup.cs
- DiffuseMaterial.cs
- InstanceData.cs
- DependencyObject.cs
- MailHeaderInfo.cs
- VectorAnimationUsingKeyFrames.cs