TypeDescriptor Class
Defines the data type of a parameter for a method.
Inheritance Hierarchy
System.Object
Microsoft.Office.Server.ApplicationRegistry.MetadataModel.MetadataObject
Microsoft.Office.Server.ApplicationRegistry.MetadataModel.TypeDescriptor
Namespace: Microsoft.Office.Server.ApplicationRegistry.MetadataModel
Assembly: Microsoft.SharePoint.Portal (in Microsoft.SharePoint.Portal.dll)
Syntax
'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class TypeDescriptor _
Inherits MetadataObject
'Usage
Dim instance As TypeDescriptor
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class TypeDescriptor : MetadataObject
Remarks
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.
Warning
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.
Note
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.
Schema
Child |
Type |
Occurs |
Default |
Limits / Accepted Values |
Description |
---|---|---|---|---|---|
TypeName |
Attribute (String) |
1..1 |
Min. length: 1 Max. length: 255 |
Name of the type in the line-of-business (LOB) system's type system that is described by this TypeDescriptor object. The ITypeReflector interface associated with this TypeDescriptor object's Parameter object is responsible for resolving this LOB system type into a .NET Type. In the case of both Web services and databases (Microsoft ADO.NET), the "LOB system type system" is .NET, so the value of TypeName is simply a .NET Type name. However, in the case of web services, the type name is followed by a ',' and the LobSystemName. |
|
IdentifierName |
Attribute (String) |
0..1 |
Name of the identifier represented by this TypeDescriptor object. If this TypeDecsriptor object describes an input parameter of a SpecificFinder mehtod, the parameter is populated with the identifier's value when you call FindSpecific. If this TypeDescriptor object describes an output parameter or a Finder or SpecificFinder method, the value of the parameter is included in the identifier values collection of returned entity instances when you call FindFiltered or FindSpecific. |
||
IdentifierEntityName |
Attribute (String) |
0..1 |
The entity containing this TypeDescriptor object |
Name of the entity that contains the identifier represented by this TypeDescriptor object. IdentifierEntityName is necessary when you model an association as a method on a source entity. In this case, the source entity returns instances of the destination entity, so you must set IdentifierEntityName to the name of the destination entity. |
|
AssociatedFilter |
Attribute (String) |
0..1 |
Max. TypeDescriptor objects per FilterDescriptor: 10 |
Name of the filter associated with this TypeDescriptor object. |
|
IsCollection |
Attribute (Boolean) |
0..1 |
false |
Specifies whether the TypeDescriptor object represents a collection. If true, the TypeDescriptor object must contain exactly one child TypeDescriptor object that describes an element in the collection. The return parameter of a Finder method must have a TypeDescriptor with IsCollection = true. |
|
DefaultValues |
Element |
0..1 |
Max. default values per TypeDescriptor object: 10 |
Container element for DefaultValue. |
|
TypeDescriptors |
Element |
0..1 |
Max. TypeDescriptor objects per TypeDescriptor: 300 |
Container element for TypeDescriptor. |
Properties
Following are the properties that the TypeDescriptor object accepts for both database and Web service systems.
Property |
Type |
Required |
Default Value |
Limits/Accepted Values |
Comments |
---|---|---|---|---|---|
DisplayByDefault |
System.Boolean |
No |
false |
true false |
If true, this field is displayed by default in the Business Data Web Parts and in the Business Data Picker. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.Office.Server.ApplicationRegistry.MetadataModel Namespace