Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRISOpens in a new window, see the InterSystems IRIS Migration Guide and Migrating to InterSystems IRIS, both available on the WRC Distributions pageOpens in a new window (login required).

Clean Up

You should add code to your project that ensures that the resources used by the CMP are freed when the application finishes with them. All .NET proxy objects as well as CacheConnection implement the Dispose method for this purpose.

For example, if your application implements a Dispose method, you should modify it so that it disposes of the connection to Caché as well as any .NET proxy objects.

Here is an example of a Dispose method for a .NET Windows Form. The code for disposing of the connection to Caché and any .NET proxy objects must be added manually. Visual Studio automatically generates the rest of the code.


protected override void Dispose(bool disposing)
{
  if (disposing && (components != null))
  {
    components.Dispose();
    //Clean up the database connection
    if (cnCache != null) cnCache.Dispose();
    //Clean up a proxy object
    if (proxyObj !=null) proxyObj.Dispose();
   }
  base.Dispose(disposing);
}      
Copy code to clipboard

In the example, cnCache represents a CacheConnection and proxyObj represents .NET proxy object.

FeedbackOpens in a new window