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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about state and transaction boundaries 1

Status
Not open for further replies.

entaroadun

Programmer
Joined
Sep 27, 2002
Messages
583
Location
US
I am new to COM+ and transactional programming in general, so please bear with me...

I am writing in VB 6 for a W2K SP2 machine.

I have two components: a business logic and a database-write. The business logic component requires a transaction. It is accessed by the client application. It instantiates the database component to do the actual updates. Can I set the database-write component to not support transactions?

I want to do this because I want my database component to retain state within the business component transaction. I want to call Database.Initialize(), Database.AddParameters(), Database.Execute() from within a Business.UpdateData() function. If the Database component supports transactions, then the state of the instance disappears between method calls. Of course, I want the Database component to lose state, but only after the entire Business transaction is done.

Is this possible?

As an aside, how do I make it so the Database component can only be instantiated from within the Business component? I have to set the class as Multiuse, which makes it public. I don't want the client app to be able to instantiate Database components. I am new to COM+ roles and security so I need guidance here as well.

Thank you all very much for any help you can provide.
 
What you can do between calls in your business logic component is
GetObjectContext.DisableCommit()
but if you want to have the database object be able to commit at a finer ganularity (spelling) then have it require a new transaction so it gets it own context.
then if you want to retain info between calls make sure you don't execute Setcomplete or setabort. you call DisableCommit on the call that starts the stateful state of the object and that the the database access object is declared at the right scope in the buisness logic object so that it doesn't fall out of scope betweens calls.

Hope this helps...oh don't forget to EnableCommit Before doing a setcomplete if you disableCommit.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top