Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

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);
}      

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

Feedback