Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Work Issues
  4. COM+ Transaction 70-320 exam question

COM+ Transaction 70-320 exam question

Scheduled Pinned Locked Moved Work Issues
questioncomannouncementcareer
2 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CillyMe
    wrote on last edited by
    #1

    COM+ Transaction 70-320 exam question [Transaction(TransactionOption.Required)] [SecurityRole("Admin")] public class SalesProcessor { public void PlaceOrder() { //STEP 1: Code here to insert order to order table, calling method on another COM+ component participating in the transaction. objCOM1.InsertOrder(...); //STEP 2: Code here to update shipping table. Again, calling method on a second COM+ component participating in the transaction. objCOM2.UpdateShipping(...); } } The question is, what do you need to add in order for the transaction initiated by PlaceOrder to be executed properly. You options are: a. Add [AutoComplete(true)] to PlaceOrder b. Add EnableCommit( ) to "End" of PlaceOrder method. c. ... not viable option ... d. ... not viable option ... The model answer is "EnableCommit" (That's option *b*). But I don't understand why. I never used EnableCommit( ) before, never had to. If I don't use [AutoComplete(true)] to automatically call SetComplete and SetAbort, I'd do it manually: public void PlaceOrder() { ContextUtil.EnableCommit( ); //Is this how you use EnableCommit()? But "option b" suggested that it should be added at the END of the method after the processing... That's weird. try { objCOM1.InsertOrder(...); objCOM2.UpdateShipping(...); ContextUtil.SetComplete(...); } catch(Exception er) { ... exception prcessing ... ContextUtil.SetAbort( ); } } Otherwise, [AutoComplete(true)] would do the job: [AutoComplete(true)] public void PlaceOrder() { objCOM1.InsertOrder(...); objCOM2.UpdateShipping(...); } Thanks.

    T 1 Reply Last reply
    0
    • C CillyMe

      COM+ Transaction 70-320 exam question [Transaction(TransactionOption.Required)] [SecurityRole("Admin")] public class SalesProcessor { public void PlaceOrder() { //STEP 1: Code here to insert order to order table, calling method on another COM+ component participating in the transaction. objCOM1.InsertOrder(...); //STEP 2: Code here to update shipping table. Again, calling method on a second COM+ component participating in the transaction. objCOM2.UpdateShipping(...); } } The question is, what do you need to add in order for the transaction initiated by PlaceOrder to be executed properly. You options are: a. Add [AutoComplete(true)] to PlaceOrder b. Add EnableCommit( ) to "End" of PlaceOrder method. c. ... not viable option ... d. ... not viable option ... The model answer is "EnableCommit" (That's option *b*). But I don't understand why. I never used EnableCommit( ) before, never had to. If I don't use [AutoComplete(true)] to automatically call SetComplete and SetAbort, I'd do it manually: public void PlaceOrder() { ContextUtil.EnableCommit( ); //Is this how you use EnableCommit()? But "option b" suggested that it should be added at the END of the method after the processing... That's weird. try { objCOM1.InsertOrder(...); objCOM2.UpdateShipping(...); ContextUtil.SetComplete(...); } catch(Exception er) { ... exception prcessing ... ContextUtil.SetAbort( ); } } Otherwise, [AutoComplete(true)] would do the job: [AutoComplete(true)] public void PlaceOrder() { objCOM1.InsertOrder(...); objCOM2.UpdateShipping(...); } Thanks.

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      I don't think I would call EnableCommit as a matter of course (for example, as the first line of code in PlaceHolder). What that says is, "Regardless of what I do with the code in PlaceHolder that may impact my transaction, I choose to vote for committing it anyway." That is to say, in general, you call EnableCommit *after* the body of your transaction-aware code has executed, to tell other participants in the transaction that your code is unaware of any reason not to commit. Second (and I am not a COM+ transaction authority), my understanding of AutoComplete versus EnableCommit is that AutoComplete is used to both ensure the creation of a transaction, and ensure that SetComplete is called if the tagged method returns normally(PlaceHolder in this case). Marking the method as AutoComplete(true) suggests that PlaceHolder is the first and last bit of logic to use the created transaction. Can't tell by your question, but I must assume there may be other methods called either before or after PlaceHolder that also intend to use the transaction. SetComplete sets both the IsConsistent and IsDone bits on a transaction context, indicating that the transaction should proceed with the act of committing itself (bad news if other logic needs the transaction), while EnableCommit only sets the IsConsistent bit, allowing further code to use the transaction instead of trying to commit it immediately. If PlaceHolder actually sits in the middle of other methods, all of which are intended for use in the same transaction context, setting EnableCommit at the end of PlaceHolder's execution would be the right choice with regards to transaction integrity.

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups