Transactions are must when working on real time projects, always compliy with ACID properties
Try the following:
TransactionManager tran = DataRepository.Provider.CreateTransaction();
tran.BeginTransaction();
bool success = false;
try
{
// do some inserts / updates / etc
DataRepository.TicketProvider.Update(tran, ticket); //OR INSERT METHOD
UpdateSharePointLibrary(ticket.XML);
success = true;
}
Catch(Exception ex)
{
Success = false;
}
finally
{
if (success)
tran.Commit();
else
tran.Rollback();
}
If the above approach doesn't work try the one below:
try
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue))
{
//web service call
// db calls
...
scope.Complete();
}//scope
}
catch (Exception ex)
{
.....
}
No comments:
Post a Comment