I'm working on the bug fix to add the "working" dialogue to gift batch import and export, This has been done in other code by assigning a new thread for the client remoting call. However, in these cases, the remoting calls return values which is not liked by the normal thread assignment functions.
I discussed it with Christian and he suggested using the new Task<T> functions from .Net 4.0. So I have coded up a first pass below.
There are a couple of questions
According to the literature, the LongRunning option should normally force a new thread outside of the thread pool. However, there are several caveats where it is possible, now or in the future, that a new stand-alone thread might not be created. What impact would this have on the current "working" dialogue logic?
Will thread pooling and thread assignment work the same on Linux?
If an exception occurs, what should the user see? What should the client do?
Note: I have not tested this yet so I may have errors in the code. (are there test gift import batches I can use?)
=====================================================================
To be added to UC_GiftBatches.Import.cs, approx. line 98
// Using Task so method result can be returned
// LongRunning Task *should* force a new thread
// TODO verify any differences under Linux
Task<bool> task = Task.Factory.StartNew<bool>(
() => TRemote.MFinance.Gift.WebConnectors.ImportGiftBatches(
requestParams,
importString,
out AMessages),
TaskCreationOptions.LongRunning);
try
{
ok = task.Result;
}
catch (AggregateException aex)
{
//TODO define and code exception actions
}
//ok = TRemote.MFinance.Gift.WebConnectors.ImportGiftBatches(
// requestParams,
// importString,
// out AMessages);
ShowMessages(AMessages);