@josecgomez I tried looping through my test function using a bpm and got the following error
The underlying provider failed on EnlistTransaction
this led me to your provided solution https://www.epiusers.help/t/method-directive-error-why-does-the-2nd-one-not-work/60209/7.
I updated my BPM that was calling the function to loop through a list of orders instead of the DB directly and now it runs without issue.
I wanted to clarify. Should I only loop through read only Dbs as a list and still loop through the write Dbs directly? For example, my function A (Requires transaction) would look like this
// FUNCTION A
foreach(var oHead in (from h in Db.OrderHed.With(LockHint.UpdLock) where
h.Company == this.CompanyID &&
h.OrderNum == inputOrderNum
select h))
{
// CALL FUNCTION B
var customerName = this.ThisLib.B(oHead.CustNum);
oHead.OrderComment = customerName + " " + DateTime.Now.ToString("MM/dd/yyyy h:mm:ss tt");
}
Db.SaveChanges();
and my function B would look like this
// FUNCTION B
var customers = (from c in Db.Customer where
c.Company == this.CompanyID &&
c.CustNum == inputCustNum
select c);
foreach(var customer in customers)
{
outputName = customer.Name;
}