Partager via


TypeDescriptor, classe (Microsoft.Office.Server.ApplicationRegistry.MetadataModel)

Defines the data type of a parameter for a method.

Espace de noms : Microsoft.Office.Server.ApplicationRegistry.MetadataModel
Assembly : Microsoft.SharePoint.Portal (dans microsoft.sharepoint.portal.dll)

Syntaxe

'Déclaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
Public Class TypeDescriptor
    Inherits MetadataObject
'Utilisation
Dim instance As TypeDescriptor
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
public class TypeDescriptor : MetadataObject

Remarques

Every Parameter object has a TypeDescriptor object that defines the data type of the parameter. It is the most complex metadata object. It is a hierarchical object that recursively describes an abstract data structure built of primitives. In addition, each leaf node of the TypeDescriptor tree points to a set of possible default values specified by the MethodInstance object Therefore, given a MethodInstance and a parameter, the parameter's TypeDescriptor is a recipe to instantiate a default value for that parameter.

In addition, TypeDescriptors form the heart of the Business Data Catalog's ability to transform complex backend APIs into simple stereotypical operations like Find, FindSpecific, CheckAccess, ad so on. Once you define detailed type information via the TypeDescriptor metadata, you can tag TypeDescriptors as slots where Identifiers or Filter values can be plugged in by the Business Data Catalog. For example, a TypeDescriptor in a Parameter that is tagged to receive the Identifier for an Entity, results in a Method that can be used as a SpecificFinder.

Use the IsCollection property on a return TypeDescriptor object to indicate wherever there are collections within the return parameter. Consider a Web method that return collections of customers, each customer of which contains a collection of Addresses. In this example, the flag must be set twice—once at the root Customer[] level, and then again at the Customer[0].Address[] level. However, a collection TypeDescriptor object can have only a single child TypeDescriptor object under it that represents the structure in the collection.

Business Data Catalog clients such as the Business Data Web Parts do not handle complex structures. For example, consider the following structures:

class Customer { String Name; Address address; } 
class Address { Street street; String city; String zip; }
class Street { int Block; String street; }

To work around this limitation, Business Data Catalog supports the concept of "complex formatting." Because clients support flat structures of primitives, the Business Data Catalog will "render" complex structures as formatted strings via two mechanisms: a simple .NET Framework String formatter, or a more complex Renderer that one can write using any .NET language. This is accomplished by setting two String properties with the names "FormatString" (e.g. "{0}, {1} \n {2}, {3}") or "RendererDefinition" (MyMethodName!MyTypeName, MyAssemblyName), respectively. The Method object in the RendererDefinition must correspond to a public static .NET method on a public .NET Type that takes a single argument, which is an array of Objects. In either case, what gets passed to the Format string or to the .NET Renderer is basically an array of all the primitive child values of the complex structure, as modeled by the Business Data Catalog TypeDescriptor definition for that structure.

Avertissement

Complex formatting is slow; use it only if absolutely necessary.

A controlling property called "ComplexFormatting" must appear on any structure that contains complex fields, to enable complex rendering.

Notes

Be careful when tagging identifiers for complex formatting, because identifiers are used for both input and output to the back-end application (when getting the Addresses for a Customer, the Business Data Catalog looks for the Customer Key to give to the GetAddressesForCustomer method). If an identifier has been rendered as a formatted string, all type information is lost and it can no longer be used as input.

Hiérarchie d'héritage

System.Object
   Microsoft.Office.Server.ApplicationRegistry.MetadataModel.MetadataObject
    Microsoft.Office.Server.ApplicationRegistry.MetadataModel.TypeDescriptor

Sécurité des threads

Les membres statiques publics de ce type (Shared en Visual Basic) sont sécurisés au niveau des threads. Il n'est pas garanti que les membres d'instance soient sécurisés au niveau des threads.

Voir aussi

Référence

Membres TypeDescriptor
Microsoft.Office.Server.ApplicationRegistry.MetadataModel, espace de noms