Transaction Rollback

Topics: Data Access Application Block, Enterprise Library Core, General discussion
Sep 16, 2007 at 7:15 PM
In my released project i used to use Enterprise Library 2.0 and System.Transactions transactions. When i heard of Enterprise library 3.1 solved light weight transaction(with sql server 2005) problem, i upgraded my project; but i have started hearing complaints that when some processes fail to end,some of database changes are not rollingback( i found out that they were right) . It was right after i upgraded project to EL 3.1 . I double checked my code, it is no possible to cause that. Especially, the code block ,which is not is rolling back , is the last operation in the transaction context . So there is only one option to my mind , when i complete the transaction ,a problem occurs. When i check exception logs,i usually see deadlock problems anyway. I need an urgent help,I am suffering of it. Is this possible,do you think, EL 3.1 to cause that?
Sep 17, 2007 at 2:07 PM
Hi,

Can you provide additional details about your application? Is it a web application? What does your updated code look like?

Fernando
Sep 17, 2007 at 2:25 PM
Edited Sep 17, 2007 at 2:45 PM

Project has both windows and web UI . But complaints's source is windows application(it is already under heavy use). Transaction :

public LisansContext ProcessVize(LisansContext context)
{
try
{
PrepareVizeInput(context);

LisansProcessingState ruleCheckState = RuleCheckForVize(context);

if (ruleCheckState == LisansProcessingState.FAILED)
return context;

#region Transaction

using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, TransactionHelper.NewTransactionOption))
{
CompleteVizeInput(context);

context.OyuncuLisans = _oyuncuLisansDao.Insert(context.OyuncuLisans);
context.Oyuncu = _oyuncuDao.Update(context.Oyuncu);

UpdateOzlukBilgileri(context);
UpdateKulupBakiyeByIslemGideri(context);
UpdateTakimKadro(context);

transaction.Complete();
}

#endregion
}
catch (Exception ex)
{
HandleException(ex);
return null;
}

return context;
}


And not rollingback code block :

private void UpdateKulupBakiyeByIslemGideri(LisansContext context)
{
IslemGideriHandlerBase islemGiderHandler = IslemGideriChainFactory.CreateChainByLisansTurKod(context.OyuncuLisans.LisansTurKod);

IslemGiderEntity islemGideri = islemGiderHandler.HandleIslemGideri(context);

if (islemGideri != null)
{
decimal tutar;

if (RuleHelper.IsAmatorTransfer(context) && context.OyuncuLisans.ASKFReferansi == true)
tutar = islemGideri.ReferansliBedel;
else
tutar = islemGideri.ReferanssizBedel.Value;

_kulupDao.SetBakiyeFark(context.OyuncuLisans.YeniKulupID.Value,-tutar);

#region Netsis

TffBolgeEntity bolgeEntity = new TffBolgeDAO().Load(context.OyuncuLisans.BolgeKodu);

new AmatorIslem().ParaCek(0, 0, context.YeniKulup.KulupKodu, context.Oyuncu.LisansNo, tutar, islemGideri.IslemTurKodu, bolgeEntity.MuhBolgeRefKodu);

#endregion
}
}

I have just discovered that UpdateTakimKadro method is not also rollingback . I know that sub methods also involved in transaction(with System.Transactions)



fsimonazzi wrote:
Hi,

Can you provide additional details about your application? Is it a web application? What does your updated code look like?

Fernando

Sep 17, 2007 at 2:54 PM
Is this a multi-threaded app?

Fernando
Sep 17, 2007 at 5:28 PM

No , whole application runs on a single thread all the time.


fsimonazzi wrote:
Is this a multi-threaded app?

Fernando