If I have a method that has the "[Transactional(TransactionalTypes.TransactionScope)]" attribute(DataPortal_Insert, DataPortal_Update, DataPortal_Delete) and I want to run a command before the transaction is started (specifically, calling the SQL "sp_setapprole" stored procedure to active a SQL Application Role), how could I go about doing that?
I am trying to keep the code nice and elegant and don't really want to exclude the transaction attribute to handle the transaction myself if I can help it. Is there something in the CSLA framework that is designed to handle this kind of activity?
This is exactly right - if you want more control over the transaction (setting isolation levels for example) or if you want to have some code in the transaction and other code outside the transaction or if you want multiple transactions, then you need to manually set up the transaction yourself.
The good news here is that when it comes to using a TransactionScope, CSLA is only saving you 3 lines of code, two of which are { and } :)
I almost didn't even add this support at all - why bother to save such simple code - but it provided parity with the pre-existing model from CSLA 1.x and so I decided to provide the support.
Copyright (c) Marimer LLC