CLR InteroperabilityAs explained in Chapter 5, "The X++ Programming Language," you can invoke external managed components from Dynamics AX by using CLR interoperability. CLR interoperability can be used from any Dynamics AX kernel, so you can use it from either type of Business Connector included with Dynamics AX 4.0. Why should you consider using CLR interoperability? You might need to invoke functionality provided by an externally managed program during some processing activity in the Business Connector, and rather than invoke the managed program on the AOS, you could choose to exploit the processing capacity of the Business Connector, especially if it is located on a separate machine. The diagram in Figure 8-10 shows how CLR interoperability works from the .NET Business Connector. Figure 8-10. Invoking externally managed components from the .NET Business Connector using CLR interoperability.
In this scenario, a bicycle distributor has purchased a third-party managed component, called ThirdPartyUtilities, that contains the business logic necessary to validate an account number. The managed component must be integrated into the Dynamics AX application, which processes account information by using the Business Connector. The following steps illustrate the use of CLR interoperability from within the .NET Business Connector for enabling the ThirdPartyUtilities managed component: At run time, the managed application invokes the validateAccNum X++ method in the ProcessingManager class, which then instantiates the CLR object from the Business Connector and returns a Boolean result. By default, the X++ methods execute from the location where they are called, which in this case is the Business Connector. Therefore, the processing associated with this request is performed in the interpreter within the Business Connector, rather than in the AOS. |