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. C#
  4. Transactions between layers

Transactions between layers

Scheduled Pinned Locked Moved C#
questiondatabasebusiness
3 Posts 2 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.
  • L Offline
    L Offline
    Luis C Lopez
    wrote on last edited by
    #1

    How can i manage database transactions between layers? Using Presentation, business and data layers. One solution i found is to declare transaction in the business layer then pass it as parameter to the DAL, but i think that's the worse i can do. Any ideas?


    Never argue with an idiot. They drag you down to their level, then beat you with experience. - Dilbert

    D 1 Reply Last reply
    0
    • L Luis C Lopez

      How can i manage database transactions between layers? Using Presentation, business and data layers. One solution i found is to declare transaction in the business layer then pass it as parameter to the DAL, but i think that's the worse i can do. Any ideas?


      Never argue with an idiot. They drag you down to their level, then beat you with experience. - Dilbert

      D Offline
      D Offline
      Dustin Metzgar
      wrote on last edited by
      #2

      That depends on what you're using. If you're .Net 2.0 and all on the same machine, just use the System.Transactions namespace. Open up a TransactionScope and every call that gets made within that will subscribe to that transaction automatically. If you're in .Net 1.1, you could use COM+ (System.EnterpriseServices) and carry the transaction that way. If you're on different machines separated by web services or remoting, it gets a little more complex. In .Net 1.1 and 2.0 you can use TIP (Transaction Internet Protocol), which is a part of COM+ to handle transactions across machines. But an even better solution comes with .Net 3.0 where WCF gives you the ability to carry transactions across services very easily. I have an article on TIP[^] and an article on WCF[^] that explains how to spread those transactions across machines.  Essentially you can start a transaction in the presentation layer and even if the DAL is on another machine, it can subscribe to it.


      Logifusion[^]

      L 1 Reply Last reply
      0
      • D Dustin Metzgar

        That depends on what you're using. If you're .Net 2.0 and all on the same machine, just use the System.Transactions namespace. Open up a TransactionScope and every call that gets made within that will subscribe to that transaction automatically. If you're in .Net 1.1, you could use COM+ (System.EnterpriseServices) and carry the transaction that way. If you're on different machines separated by web services or remoting, it gets a little more complex. In .Net 1.1 and 2.0 you can use TIP (Transaction Internet Protocol), which is a part of COM+ to handle transactions across machines. But an even better solution comes with .Net 3.0 where WCF gives you the ability to carry transactions across services very easily. I have an article on TIP[^] and an article on WCF[^] that explains how to spread those transactions across machines.  Essentially you can start a transaction in the presentation layer and even if the DAL is on another machine, it can subscribe to it.


        Logifusion[^]

        L Offline
        L Offline
        Luis C Lopez
        wrote on last edited by
        #3

        ok. Everything is on one machine... i'm going to try with TransactionScope then, and look for some article. Thanks for answer this Dustin, i needed the advice because i'm just starting using layers.


        Never argue with an idiot. They drag you down to their level, then beat you with experience. - Dilbert

        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