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
- listitem.cs
- InvalidDataException.cs
- TypefaceMap.cs
- UTF32Encoding.cs
- RenderContext.cs
- ProtectedConfigurationProviderCollection.cs
- UpdatePanelTrigger.cs
- DBCommand.cs
- FileSystemInfo.cs
- SymbolDocumentInfo.cs
- QueueProcessor.cs
- TableLayoutPanel.cs
- HttpApplicationFactory.cs
- XPathParser.cs
- ImmutablePropertyDescriptorGridEntry.cs
- NetMsmqSecurityMode.cs
- FileLogRecordEnumerator.cs
- PinProtectionHelper.cs
- BevelBitmapEffect.cs
- XamlGridLengthSerializer.cs
- NullableDecimalAverageAggregationOperator.cs
- Grant.cs
- TemplateNameScope.cs
- ProfilePropertyNameValidator.cs
- WebSysDescriptionAttribute.cs
- XmlIterators.cs
- IncrementalReadDecoders.cs
- CodeDomDecompiler.cs
- XPathAxisIterator.cs
- WebChannelFactory.cs
- SqlResolver.cs
- WindowsPrincipal.cs
- MenuEventArgs.cs
- AlternateViewCollection.cs
- FixedBufferAttribute.cs
- ParentQuery.cs
- userdatakeys.cs
- SerTrace.cs
- SQLInt16Storage.cs
- DiagnosticsConfigurationHandler.cs
- WebPartUtil.cs
- AffineTransform3D.cs
- Ipv6Element.cs
- SamlDelegatingWriter.cs
- CurrentChangingEventArgs.cs
- OdbcEnvironmentHandle.cs
- InternalPermissions.cs
- XmlPropertyBag.cs
- DecimalAnimationBase.cs
- ExtensionWindow.cs
- CodeRemoveEventStatement.cs
- TrackingProfileCache.cs
- MimeImporter.cs
- WeakEventManager.cs
- ListBoxItemWrapperAutomationPeer.cs
- SecurityTokenTypes.cs
- DocumentSequenceHighlightLayer.cs
- wgx_sdk_version.cs
- OdbcDataAdapter.cs
- WpfKnownTypeInvoker.cs
- Switch.cs
- MetadataItem.cs
- FontSource.cs
- ConsoleCancelEventArgs.cs
- QueryAccessibilityHelpEvent.cs
- WebConfigurationHostFileChange.cs
- XmlILModule.cs
- FunctionUpdateCommand.cs
- LinkTarget.cs
- CollectionConverter.cs
- SplitterEvent.cs
- Axis.cs
- TypeExtensionSerializer.cs
- Rijndael.cs
- NavigationService.cs
- MonthCalendar.cs
- UniqueEventHelper.cs
- Baml2006ReaderSettings.cs
- AppSettingsExpressionBuilder.cs
- Switch.cs
- HtmlUtf8RawTextWriter.cs
- MetadataSource.cs
- Missing.cs
- RegexWriter.cs
- HandleCollector.cs
- InteropEnvironment.cs
- DataListCommandEventArgs.cs
- DockPattern.cs
- Underline.cs
- GridViewDeletedEventArgs.cs
- WindowsSpinner.cs
- Control.cs
- NumberFunctions.cs
- RuntimeCompatibilityAttribute.cs
- DataGridColumn.cs
- FlowLayoutPanel.cs
- GPPOINTF.cs
- SmtpFailedRecipientsException.cs
- WSTrust.cs
- PixelShader.cs