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. Database & SysAdmin
  3. Database
  4. Transactions between layers.

Transactions between layers.

Scheduled Pinned Locked Moved Database
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

    C 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

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      The DAL deals with the transactions. From the business layer you can call the DAL's StartTransaction() method (or what ever you call to choose it) and if everything goes okay you can call the DAL's CommitTransaction() and if not RollbackTransaction() Remember to ensure that the Commit/Rollback-Transaction() method calls are in a finally block in case something goes wrong because you want to ensure that they are called.


      Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

      L 1 Reply Last reply
      0
      • C Colin Angus Mackay

        The DAL deals with the transactions. From the business layer you can call the DAL's StartTransaction() method (or what ever you call to choose it) and if everything goes okay you can call the DAL's CommitTransaction() and if not RollbackTransaction() Remember to ensure that the Commit/Rollback-Transaction() method calls are in a finally block in case something goes wrong because you want to ensure that they are called.


        Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

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

        Thanks Collin , someone told me that i can use the transactionscope statement.. I think this would solve my problem. By the way, i read your sql injection article and is one of my favorites. Thanks again.


        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