The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Advise for saving data in the middle of an other transaction

Last post 02-04-2007, 5:18 AM by Mike.Griffin. 3 replies.
Sort Posts: Previous Next
  •  02-02-2007, 11:42 AM 95

    Advise for saving data in the middle of an other transaction

    I'm breaking my brains for some hours why my errors aren't saved to my database.

    Finally came to the idea to check SQL profiler and saw that after the insert in the error log there was a transaction rollback. Slowly I saw the light .. Idea

    The program is in the middle of an Transaction (EntitySpaces.Interfaces.esTransactionScope) an exception happens, the code goes to the ExceptionHandling code.

    The error get's logged in the database (also with ES code) and then rolled back, because the original code never reaches the transactieScope.Complete().

    Any advise how I could work around this? I'm using SQL dynamic with Sql server 2000.

    I tried to start a new transaction in the error logging code, but that doesn't help.

    Any ideas are welcome.

    Thanks !

    Regards,

    Bas
     

  •  02-03-2007, 6:20 AM 96 in reply to 95

    Re: Advise for saving data in the middle of an other transaction

    Yes, interesting, looks like we need the ability to break out of the ongoing transaction, this is not currently in the EntitySpaces API. I think the only way to accomplish this currently is to call a stored procedure via ExecuteNonQuery which is a protected method in your entity/collection classes. I am adding this to our tracking system so we can provide you with this ability.  Currently Save() on all objects will partake in the same transaction. 


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  02-04-2007, 4:10 AM 106 in reply to 96

    Re: Advise for saving data in the middle of an other transaction

    Thanks for your anwser Mike.

    I agree that wrapping it up in a stored procedure is probably the best way, especially for an error logging action (I'm just getting lazy with ES ;-)).

    For the future:

    Would it be a good idea to add objects to an transaction? A bit like you have to do in standard ADO.net. On the other hand, that would break the current functionality.

    Regards,

    Bas 


     

  •  02-04-2007, 5:18 AM 107 in reply to 106

    Re: Advise for saving data in the middle of an other transaction

    Manually transaction handling is something we wont add. The way ES handles transactions is the way it should be done. I'm on a project (not using ES as the direction was set before I got there) and they are passing around a transaction all throughout their API and forgetting to use it here and there, it has cost us weeks and weeks of debugging. We are going to add the ability for you to break out of the transaction like a COM+ "Requires New" however. Most ORM systems make you deal with a context and a transaction separately from your business objects and it makes for a very laborious programming task, ES is so "easy" because we make all of that transparent.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML