Editor 2.4 Options Error
Editor 2.4 Options Error

So an interesting issue I'm encountering in 2.4 (not present in 2.3.2).
I have a custom function that loads the options on the server side for a list of employees, code to call it is:
editor.Field(new Field("REFERRAL.Referee_EmployeeID").Options((db,search) => base.RefereesForReferral(referralID, employeeID, employeeID))
.Validator(Validation.NotEmpty(new ValidationOpts { Message = "Referee Must be Provided" })));
The function just returns a Dictionary as required for the options (code is a bit long but can share via PM if necessary).
On initial load, this function seemingly works fine, however after attempting an edit, the system throws an error:
An error occurred while executing the command definition. See the inner exception for details
In digging through the Editor.cs, the InnerException it is throwing is:
{"Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding."}
This seems to be occurring on line 2125:
var opts = options.Exec(_db, refresh);
The options seem to recognize the customFn:
But then it does the options.Exec(_db, refresh) and times out.
This is new in 2.4, and rolling back to 2.3.2 fixes the issue.
Let me know if I can provide additional information
This question has an accepted answers - jump to answer
Answers
As a small update setting
fixes this since the call inside the custom function does make use of Entity Framework to do some query. Obviously there was some collision occurring.
Interesting it didn't occur in the previous version though.
I'm not sure I want it to run without Transactions, so I'm wondering if there are any other thoughts on it. I'm wondering if re-writing the separate function to utilize the DataTables db item passed back and using that rather than Entity Framework would work better?
As a second update,
I managed to get this working without disabling Transactions by updating the custom function to use the passed in DataTables database option, rather than the standard Entity Framework database option.
This is a workable solution for me, but would still be interested to know why it went awry
Interesting - thanks for posting this. From your description, I suspect that the write lock of the update action is preventing the separate EF connection from completing. It needs a read lock, but it can't get one until the write lock is released, which it can't get until the read is complete!
If they were using the same database connection, it wouldn't be an issue, since it would all be in one transaction. Disabling the transaction Editor uses means that a write lock isn't held, therefore the EF read is allowed to complete.
I agree, if you were to rewrite the options data collection to use the same database connection as Editor is using, it wouldn't be a problem.
The Options in 2.4 were completely rewritten to operate for the new
tags
andautocomplete
fields. Part of that was to update the options on update, which it never used to do before (which was a bit of an issue at times). That's which this has now raised its head.Regards,
Allan