I have some business logic I would like to execute prior to/while saving a BusinessObject. I tried to to this in the DataPortal_Insert() method.
Unfortunately, because of "[Transactional(TransactionalTypes.TransactionScope)]" I cannot use any other calls to DataPortal_Fetch(), because these lead to "System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first."
Is there any other way around this besides using the logic on the server (say e.g. stored procedures)? Plus: I would, of course, wanted the other calls/updates to run in this transaction, too... but these updates are not really child objects of the object I am trying to persist.
TIA,
Remoray
ajj3085:Hi,
You can read in your DP_I or DP_U, but the same rules apply to datareaders; only one can be open at a time. So you'll have to rework your code around this. You could also use MARS in your connection string, but I'm not sure what other changes that would introduce. MARS = Multiple Active Result Sets.
Thank you, I will have to rework the code then... ;-)
Remoray:I have some business logic I would like to execute prior to/while saving a BusinessObject. I tried to to this in the DataPortal_Insert() method.
Unfortunately, because of "[Transactional(TransactionalTypes.TransactionScope)]" I cannot use any other calls to DataPortal_Fetch(), because these lead to "System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first."
Is there any other way around this besides using the logic on the server (say e.g. stored procedures)? Plus: I would, of course, wanted the other calls/updates to run in this transaction, too... but these updates are not really child objects of the object I am trying to persist.
TIA,
Remoray
...maybe work on using another method that cascades the connection or transaction so it can be shared but use a new command...
private... DP_Fetch(criteria)
using (connection with transaction conn){
using(command cmd){
// to stuff
doMoreStuff(conn);
}
}
Copyright (c) Marimer LLC