Consultor Eletrônico



Kbase P105348: When disposing of an AppObject from a .NET Open Client, must you also dispose all SubAppObjects and
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/10/2005
Status: Verified

GOAL:

When disposing of an AppObject from a .NET Open Client, must you also dispose all SubAppObjects and ProcObjects in order to release the Connection?

GOAL:

How to release an AppServer connection from a .NET Open Client

FACT(s) (Environment):

OpenEdge 10.x

FIX:

When the .NET proxy uses only an AppObject (i.e. no SubAppObjects or ProcObjects), using the dispose() method of the AppObject is sufficient to release the connection to the AppServer.

When either SubAppObjects or ProcObjects are used, those objects must have their dispose() methods called to release them before the AppObject has its dispose() method called. If you do not call dispose() for all SubAppObjects and ProcObjects the connection to the AppServer will not be released.


Example of C# code:

// Connect to the AppServer using the AppObject
MyAppObject vAppServer = new MyAppObject(vConnectionObject);

// Instantiate Persistent procedure on the AppServer (Retain Object Reference)
MyProcObject vPersistentProcedure = vAppServer.CreatePO_SomePersistentProcedure();

// Call Internal Procedure within Persistent Procedure
vPersistentProcedure.SomeInternalProcedure();

// Instantiate SubAppObject defined within AppObject (i.e. Proxy)
MySubAppObject vSubAppObject = vAppServer.CreateAO_SubAppObject();

// Required. Dispose of Instantiated SubAppObject
vSubAppObject.Dispose();

// Required. Dispose of Instantiated Persistent Procedure
vPersistentProcedure.Dispose();

// Required. Dispose of Instantiated AppObject (Connection to AppServer is now Released)
vAppServer.Dispose();