Sharing ADO.NET Database Connections
Contents
PowerBuilder applications can share database ADO.NET connections
with third-party .NET assemblies exposed as COM through a connection
proxy. The connection proxy is an instance of type
IAdoConnectionProxy.
The IAdoConnectionProxy interface is defined in the
Sybase.PowerBuilder.DataSource.Sharing.dll assembly as follows:
|
1 2 3 4 5 |
IAdoConnectionProxy { object Connection; //accepts System.Data.IDbConnection object Transaction; //accepts System.Data.IDbTransaction event EventHandler TransactionChanged; } |
Both the PowerBuilder application and the third-party assembly
manage connections and transactions by referencing the proxy.
The assembly must be registered as COM by using regasm.exe under the
Microsoft.NETFrameworkv4.0 folder. Please refer to the Microsoft MSDN
library for information about regasm.exe.
The PowerBuilder Transaction object is the standard PowerBuilder
nonvisual object used in database connections. To manage the shared
connection, the Transaction object references the
AdoConnectionProxy object using these methods:
-
bool SetAdoConnection (oleobject connectionProxy) — accepts an
imported ADO.NET connection. -
oleobject GetAdoConnection() — accepts an ADO.NET connection
exported from the Transaction object.