Editar

Compartilhar via


Extending BizTalk Editor

BizTalk Editor is designed to allow extensions that support alternative instance message formats. In fact, the XML format is the only format that is built into BizTalk Editor. Even support for flat file formats, which is included in Microsoft BizTalk Server, is implemented as a BizTalk Editor extension, thereby serving as a good example of the type of functionality that can be added by such extensions.

In general, BizTalk Editor extensions persist their custom data as XML Schema definition (XSD) language annotations associated with the XSD elements that correspond to the nodes in the schema tree. Again, the extensive set of annotations added by the Flat File Extension to BizTalk Editor serves as a good example of the way in which BizTalk Editor extensions can persist their custom data in the schema.

BizTalk Editor extensions are .NET assemblies that extend the functionality of BizTalk Editor. To be identified as an extension, an assembly must have one class that implements the IExtension interface, and must be located under the Developer Tools\Schema Editor Extensions folder in the product installation directory.

The developer of an extension must have its assembly reference the Microsoft.BizTalk.SchemaEditor.Extensibility.dll, which contains the definition of all the interfaces needed for exposing extended functionality to BizTalk Editor. Those interfaces are defined under the Microsoft.BizTalk.SchemaEditor.Extensibility namespace.

The IExtension interface is the entry point for the extension, from which BizTalk Editor accesses the extended functionality, such as property managers, custom views, schema validation, native instance generation, and native instance validation.

A given schema can have multiple extensions associated with it, but only one can be set as the standard at a given time; this is set in the Standard property of the Schema node. The extension currently set as the standard is the one used for native instance generation and validation, and for schema validation.

Extensions can be associated with a given schema by editing the Schema Editor Extensions property of the Schema node. The information about the extensions associated with a schema is stored in the schema itself, within the annotation element of the schema element, as illustrated in the following XSD fragment.

<?xml version="1.0" encoding="utf-16" ?>   
<xs:schema xmlns="http://BizTalk_Server_Project1.Schema11"  
        xmlns:b="http://schemas.microsoft.com/BizTalk/2003"  
        targetNamespace="http://BizTalk_Server_Project1.Schema11"  
        xmlns:xs="http://www.w3.org/2001/XMLSchema">  
    <xs:annotation>  
        <xs:appinfo>  
            <schemaEditorExtension:schemaInfo namespaceAlias="b"  
                extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension"  
                standardName="Flat File"  
                xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />  
            <b:schemaInfo schema_type="document" root_reference="Root"  
                is_receipt="no" schema_name="abc"  
                standard="Flat File"  
                count_positions_by_byte="false" />   
        </xs:appinfo>  
    </xs:annotation>  
    <xs:element name="Root">  
        ...  
  

After instantiating the extension object, the framework invokes the Initialize method of the IExtension interface, passing an ITree object so that the extension can access information about the schema tree. For example, the extension could traverse all child nodes by accessing the ITree.RootNode property.

This section describes the ways in which a BizTalk Editor extension can integrate into the BizTalk Editor environment and hook itself into existing BizTalk Editor commands.

In This Section