This is the way ATM works. It will commit or rollback when the method returns, therefore making the call to that method transactional. This is mentioned in the introduction on the web site ( http://www.castleproject.org/container/facilities/trunk/atm/index.html).
If you want both calls in a the same transaction then you don't want the Transaction attribute on the Dao calls, you want it on whatever is calling them (IMyServiceClass possibly). It may make more sense to not use "automatic" transaction management, and just explicitly create the transaction scope around the calls to MethodA and MethodB. On Sat, Dec 12, 2009 at 1:22 AM, kork <[email protected]> wrote: > i played a bit with castle facilities but i didn't found a solution, > passing IMyServiceClass to these controls doesn't works, if i call > sequentially 2 Transaction method of the same Transactional class this > will generate 2 different transaction. > > this is a more detailed example of what i need so maybe samebody has > another suggestion (in my real application i will uses interfaces/ > DI/..., this code is only to simplify my problem) > > i have this data layer classes > > [Transactional] > class DaoA > { > [Transaction] > void MethodA() { } > } > > [Transactional] > class DaoB > { > [Transaction] > void MethodB() { } > } > > > i have an aspx page where in the controls hierarchy there're 2 > control: MyControl1 and MyControl2, with > > MyControl1.OnLoad() > { > daoA_Istance.MethodA(); > } > > MyControl1.OnSameButtonClick() > { > daoB_Istance.MethodB(); > } > > and i have an httpmdule to open a session at beginRequest and dispose > it at endRequet. > > what i would like is to use an unique transaction for all the requests > to the db in tha same web request, > in my idea i want a new TransactionInterceptor wich will: > - create a new transaction if no other transaction has been defined in > the same context (as the castle TransactionInterceptor) > - throw exception or return if there's an already existing and > rollbacked transaction in the same context > - execute the code under the Transaction attribute and rollback if > same exception is thrown (it's the same as the castle > TransactionInterceptor except > that will not commit at the end of the Transaction methods is it's > all ok > > then in the httpmodule i check if there's a transaction in the > current context and if it's not rollbacked i will commit it, > > what do u think about? > > > > -- > > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]<castle-project-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > > -- Jono -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
