Stateful Business Objects & MTS

Results 1 to 2 of 2

Thread: Stateful Business Objects & MTS

  1. #1
    Join Date
    Dec 1969

    Default Stateful Business Objects & MTS

    I am trying to create my first application in the MTS world using VB6. I am trying to create a corresponding set of COM business objects. I assume that these objects will have properties (i.e. stateful data) and methods to get things done. I realize that MTS wants to use stateless objects to optimize re-use. I have seen references to partitioning applications into stateful business objects and stateless data objects interacting with database(s). Its clear to me how to implement the stateless data objects in MTS. My puzzle is how do I structure my business objects which call the data objects to do their work.<BR>1) Should the business objects also be managed under MTS?<BR>2) How do I set up the business objects for MTS transaction support so that the data object methods they call participate properly in transactions? I don&#039;t want the long-lived business object to delay completion of transactions and de-activation of the data objects, but I also I don&#039;t want to lose the property data of the business object by using SetComplete to just to force completion of a transaction.<BR><BR>Any advice greatly appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: Stateful Business Objects & MTS

    Assuming you&#039;re creating all your components (business and data) in VB and for a multi-user environment, you definately need to run them under MTS. VB6 only allows you to create single-threaded apartment components and running them outside of MTS will basically make them single-threaded, which in a multi-user environment will result in bottlenecks. You&#039;ll also want to make all your components as stateless as possible. MTS intercepts create object calls and helps to manage the instantiation of components running under it. You should fully read up on component management, transaction handling and other features MTS provides. Wrox has some excellent books on MTS and COM. If you&#039;re developing the application for production I would advise you do your research before continuing.<BR><BR>To transactionalize your processsing, your business component first needs to create an object context. This lets MTS know that you&#039;re starting a new transaction. The business object then must use "CreateInstance" to instantiate your data objects. If your data object is set so that is can handle transactions, any processing done by your data object will run under the transaction you created in your business object. There are alot more you need to consider for MTS programming so I recommend you do some research.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts