.NET Gateway Architecture
The Object Gateway for .NET provides an easy way for Ensemble to interoperate with Microsoft .NET Framework components. The .NET Gateway can instantiate an external .NET object and manipulate it as if it were a native object within Ensemble.
The external .NET object is represented within Ensemble by a “wrapper” or “proxy” class. The proxy object appears and behaves just like any other Ensemble object, but it has the capability to issue method calls out to the Common Language Runtime (CLR), either locally or remotely over a TCP/IP connection. Any method call on the proxy object triggers the appropriate class method inside the CLR.
You can use the .NET Gateway to create proxy classes for custom .NET components. However, the most powerful feature of the .NET Gateway is that it easily creates proxy mappings to entire .NET application interface specifications, such as ADO, Remoting, ASP.Net, etc. Ensemble can then use these applications without having to generate new proxy classes.
The generated proxy class is an Ensemble class. You can access it with code written in either Caché Basic or ObjectScript. The examples in this document use ObjectScript.
In general, the best approach to using the .NET Gateway is to build a small wrapper class that exposes just the functionality you want and then create a proxy for this wrapper. This makes the API between Ensemble and the .NET framework very clean and eliminates potential issues dealing with how to map more esoteric features to a proxy object.
The Using the Caché Gateway for .NET guide provides complete technical details of using the .NET Gateway. The next chapter shows how to specifically use the .NET Gateway in Ensemble.