Do I need to use a TransactionScope inside an Epicor Function?

Should I be using a transaction scope in c# written inside an Epicor function? Something like:

using (var txScope = IceContext.CreateDefaultTransactionScope()){
~Insert Code Here~
Db.Validate();

// Complete the transaction
txScope.Complete();
}

If so how to I get Db.Validate to work as I get an error message when trying to refer to the DB from a function like that. Thanks.

There’s a checkbox for that in the Function header. No need to do it in code.

3 Likes

So that require transaction box will do the exact same thing as the code? It will essentially wrap the entire contents of the function in a transaction?

1 Like

Correct

1 Like