Share via

Complex Formatting

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, the Business Data Catalog supports the concept of "complex formatting." Because clients support flat structures of primitives, the Business Data Catalog "renders" complex structures as formatted strings via two mechanisms—a simple .NET String formatter, or a more complex Renderer that one can write using any Microsoft .NET Framework language. This is accomplished by setting two String properties with the names "FormatString" (for example, "{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.


Complex formatting is slows performance; so use it only if absolutely necessary.

To enable complex rendering, a controlling property named ComplexFormatting must appear on any structure that contains complex fields. Take special care 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.