Root Collection DataPortal_Update

Root Collection DataPortal_Update

Old forum URL: forums.lhotka.net/forums/t/8395.aspx


MadGerbil posted on Thursday, January 21, 2010

I've got the silly thing working.
Does this code look right?
Is there a better way to do it?

[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
using (var ctx = ConnectionManager.GetManager("eGA"))
{
base.Child_Update();
}
}

ajj3085 replied on Thursday, January 21, 2010

Looks right to me.

The children know how to save themselves, and the collection doesn't have anything to really save.  So its only job is to open a connection so that the children all use that conneciton and particpate in the transaction, and your code does that.

rxelizondo replied on Thursday, January 21, 2010

Yeah, it looks good to me too, I just finished creating one of those too, the only difference is that I am using DB2 so my procedure looks just a tad different that yours:

protected override void DataPortal_Update()
{
using (TransactionManager<DB2Connection, DB2Transaction> ctx = TransactionManager<DB2Connection, DB2Transaction>.GetManager("DB:TMMPDirect"))
{
base.Child_Update();
ctx.Transaction.Commit();
}
}

Copyright (c) Marimer LLC