Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> How To: Implement Single Transaction For standard ADO.NET code and LLBLGen Pro code
 

Pages: 1
Bugs & Issues
How To: Implement Single Transaction For standard ADO.NET code and LLBLGen Pro code
Page:1/1 

  Print all messages in this thread  
Poster Message
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 02-May-2008 16:56:34.  
LLBLGen Pro 2.5 SS

How do I implement the following within a transaction so if any of the stored procedures return an error I need an entire rollback. I also need to keep in mind that in the future there may be ADO.NET code hitting the same database directly using ADO.NET or LINQ but not using LLBLGen Pro (so I cannot use the LLBLGen Pro transaction). Is there a way to implement this code within a transaction but also allowing the use of a regular .NET DB Transaction object to include other .NET DB functions (non LLBLGen Pro related) code within that same transaction?

    Public Sub Copy(ByVal FromAssyID As Integer, ByVal ToAssyID As Integer) Implements [Interface].Core.IAssyCopy.Copy
        'TODO: Implement Within A Transaction

        ''Dim tran As New ORM.HelperClasses.Transaction(IsolationLevel.ReadUncommitted, "CopyTransaction")
        CopyMainAssyRecord(FromAssyID, ToAssyID)

        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldSpec_Detail(FromAssyID, ToAssyID) ', tran)

        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldSpec_Spot(FromAssyID, ToAssyID) ', tran)
        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldImages_Spot(FromAssyID, ToAssyID) ', tran)

        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldSpec_Mig(FromAssyID, ToAssyID) ', tran)
        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldSpec_Mig_Segments(FromAssyID, ToAssyID) ', tran)
        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldImages_Mig(FromAssyID, ToAssyID) ', tran)
        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldSpec_Proj(FromAssyID, ToAssyID) ', tran)

        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldImages_Proj(FromAssyID, ToAssyID) ', tran)

        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_WeldImages_VisualAids(FromAssyID, ToAssyID) ', tran)

        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_Schedule_Mig(FromAssyID, ToAssyID) ', tran)
        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_Schedule_Proj(FromAssyID, ToAssyID) ', tran)
        ORM.StoredProcedureCallerClasses.ActionProcedures.Copy_Schedule_Spot(FromAssyID, ToAssyID) ', tran)

    End Sub

    Private Sub CopyMainAssyRecord(ByVal FromAssyID As Integer, ByVal ToAssyID As Integer)
        'only records in the main tblAssy table that need to be copied over are the destruct times
        Dim assyFrom As New ORM.EntityClasses.DestructTimesEntity(FromAssyID)
        Dim assyTo As New ORM.EntityClasses.DestructTimesEntity(ToAssyID)
        assyTo.Spot_DestructTime_Minutes = assyFrom.Spot_DestructTime_Minutes
        assyTo.Proj_DestructTime_Minutes = assyFrom.Proj_DestructTime_Minutes
        assyTo.Mig_DestructTime_Minutes = assyFrom.Mig_DestructTime_Minutes

        assyTo.Save()
    End Sub
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14626 posts
# Posted on: 02-May-2008 17:17:24.  
Please check .NET 2.0: System.Transactions support, in the manual's section "Using the Generated code -> Adapter/SelfServicing -> Transactions"

  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.