Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COM+ vs Stored Procedures

Status
Not open for further replies.

VBXL

Programmer
Jul 10, 2001
198
GB
I am designing a program using COM+ and Stored Procedures in Visual basic

What is the benefit of using COM+ over Stored Procedures in designing COM Components
(vice-versa)

Why would I need COM+ code in a compenent i.e.

GetObjectContext

Cheers
Xplain
 
XPlain -

The two subjects are related only because they do similar things:

Using stored procedures is typically done either as a performance enhancement, or to hide messy details from a caller.

Using a COM+ component is typically done either as a performance enhancement, or to hide messy details from a caller.


So, you can do one, the other, or both, depending on what your requirements are. If your site/application will be serving a large number of clients, then you'll want the performance benefits of doing both. Read similar threads here about designing stateless components vs. components that maintain state.

The reason you have to implement the ObjectControl interface is so that COM+/MTS can call into your component. Once to see if your component can be pooled, and then whenever the component is activated or deactivated. Any code you had in class_initialize before should be moved into the ObjectControl_Activate method.

The other thing you should do, is if the class you're writing needs to be in a transaction (i.e. everything that happens in a method call must succeed or it must fail, no exceptions) is to insert calls to the ObjectContext object. Call .SetComplete when everything was done successfully and you want to commit your database changes. And call .SetAbort when an error occurred -- COM+ will then handle the database rollbacks for you and no data will be saved.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top