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. General Programming
  3. .NET (Core and Framework)
  4. COM+ Transaction scope in .Net

COM+ Transaction scope in .Net

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharpcomdesigntutorial
3 Posts 3 Posters 0 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.
  • D Offline
    D Offline
    Daniel Jansson
    wrote on last edited by
    #1

    I've just started to work on a windows service with distributed transactions using com+ and have stumbled upon a design question: When is a transaction started? Is it when the class is created or when a method is invoked. Consider the example below:

    [Transaction(TransactionOption.Required)]
    public class TransactionTest : ServicedComponent
    {
    public TransactionTest()
    {

        }
    
        public void BeginLoop(int count)
        {
            for (int i = 0; i < count; ++i)
                MakeTransactions();
        }
    
        \[AutoComplete\]
        private void MakeTransactions()
        {
            //Make some transactions
            if ((new Random()).Next(10) < 4)
                ContextUtil.SetAbort();
            else
                ContextUtil.SetComplete();
        }
    }
    

    A simple transaction based class with a method that is being invoked multiple times internally. Are all calls to MakeTransactions() in the same transaction or is a new transaction started each time SetAbort/Complete is invoked?

    L M 2 Replies Last reply
    0
    • D Daniel Jansson

      I've just started to work on a windows service with distributed transactions using com+ and have stumbled upon a design question: When is a transaction started? Is it when the class is created or when a method is invoked. Consider the example below:

      [Transaction(TransactionOption.Required)]
      public class TransactionTest : ServicedComponent
      {
      public TransactionTest()
      {

          }
      
          public void BeginLoop(int count)
          {
              for (int i = 0; i < count; ++i)
                  MakeTransactions();
          }
      
          \[AutoComplete\]
          private void MakeTransactions()
          {
              //Make some transactions
              if ((new Random()).Next(10) < 4)
                  ContextUtil.SetAbort();
              else
                  ContextUtil.SetComplete();
          }
      }
      

      A simple transaction based class with a method that is being invoked multiple times internally. Are all calls to MakeTransactions() in the same transaction or is a new transaction started each time SetAbort/Complete is invoked?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Short answer is I don't know. I know there is a difference between starting a transaction and participating in one. The code you posted could result in only a single transaction being started and multiple participations in the transaction. There are many resources available on MSDN for the Transaction topic that you may want to dig into.

      led mike

      1 Reply Last reply
      0
      • D Daniel Jansson

        I've just started to work on a windows service with distributed transactions using com+ and have stumbled upon a design question: When is a transaction started? Is it when the class is created or when a method is invoked. Consider the example below:

        [Transaction(TransactionOption.Required)]
        public class TransactionTest : ServicedComponent
        {
        public TransactionTest()
        {

            }
        
            public void BeginLoop(int count)
            {
                for (int i = 0; i < count; ++i)
                    MakeTransactions();
            }
        
            \[AutoComplete\]
            private void MakeTransactions()
            {
                //Make some transactions
                if ((new Random()).Next(10) < 4)
                    ContextUtil.SetAbort();
                else
                    ContextUtil.SetComplete();
            }
        }
        

        A simple transaction based class with a method that is being invoked multiple times internally. Are all calls to MakeTransactions() in the same transaction or is a new transaction started each time SetAbort/Complete is invoked?

        M Offline
        M Offline
        Mike Dimmick
        wrote on last edited by
        #3

        I can only point you to Tim Ewald's excellent book Transactional COM+[^]. Note that this only covers COM+ up to Windows 2000, and the little information it has on .NET is out of date (it was published in 2001), but the core information is very much correct.

        DoEvents: Generating unexpected recursion since 1991

        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