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
- ResXResourceSet.cs
- categoryentry.cs
- SaveFileDialog.cs
- Pens.cs
- Baml6ConstructorInfo.cs
- Stack.cs
- RegisteredExpandoAttribute.cs
- FileClassifier.cs
- BamlResourceContent.cs
- PageSetupDialog.cs
- TraceXPathNavigator.cs
- CqlBlock.cs
- Pkcs7Signer.cs
- TraceSection.cs
- LayoutExceptionEventArgs.cs
- MonitoringDescriptionAttribute.cs
- XmlSchemaResource.cs
- ListViewDeleteEventArgs.cs
- TextSegment.cs
- ellipse.cs
- DbXmlEnabledProviderManifest.cs
- BufferedGraphicsManager.cs
- ColorMatrix.cs
- AutoGeneratedFieldProperties.cs
- TextDecorationLocationValidation.cs
- BinaryCommonClasses.cs
- EpmSyndicationContentDeSerializer.cs
- GlobalizationSection.cs
- LinqDataSourceInsertEventArgs.cs
- MasterPageParser.cs
- TextLine.cs
- ContractMethodInfo.cs
- VarInfo.cs
- BindingRestrictions.cs
- TextTabProperties.cs
- XmlBuffer.cs
- TypeNameParser.cs
- PassportAuthenticationModule.cs
- TreeViewImageKeyConverter.cs
- ElementAtQueryOperator.cs
- Monitor.cs
- HighlightComponent.cs
- DictionaryContent.cs
- ImageField.cs
- WasAdminWrapper.cs
- RulePatternOps.cs
- XamlRtfConverter.cs
- control.ime.cs
- Literal.cs
- SymbolPair.cs
- DataTableNewRowEvent.cs
- ImageBrush.cs
- WebBrowsableAttribute.cs
- SimpleRecyclingCache.cs
- Rotation3D.cs
- XmlSchemaFacet.cs
- ScriptDescriptor.cs
- While.cs
- SqlDataRecord.cs
- SwitchLevelAttribute.cs
- DisplayNameAttribute.cs
- SettingsBindableAttribute.cs
- ContainerAction.cs
- Int64Animation.cs
- JournalEntryListConverter.cs
- PolicyReader.cs
- TypeDelegator.cs
- MultipartContentParser.cs
- Component.cs
- FontSourceCollection.cs
- MeshGeometry3D.cs
- Vector3DAnimationBase.cs
- MsmqOutputChannel.cs
- ExpressionsCollectionConverter.cs
- SubqueryTrackingVisitor.cs
- NumberFormatter.cs
- ExpressionBindingsDialog.cs
- COSERVERINFO.cs
- NativeMethods.cs
- CommandID.cs
- List.cs
- XmlSchemaSimpleContent.cs
- AsymmetricKeyExchangeFormatter.cs
- HtmlTextBoxAdapter.cs
- ExtentCqlBlock.cs
- Utils.cs
- TextRenderingModeValidation.cs
- EntityModelBuildProvider.cs
- TransformProviderWrapper.cs
- Dictionary.cs
- LazyTextWriterCreator.cs
- OrderedDictionary.cs
- StylusPointPropertyInfo.cs
- Stack.cs
- SpellerHighlightLayer.cs
- PageRequestManager.cs
- CallbackHandler.cs
- CfgRule.cs
- CompoundFileReference.cs
- QueryTreeBuilder.cs