The action method is:
[NeedsPersistence]
public void ExecuteScheduledTasks()
{
scheduler.Execute();
}
Scheduler.Execute() is more or less:
var tasksToBeExecuted = getTask.GetTasks();
foreach (var task in tasksToBeExecuted)
{
var t = threadFactory.Create(task);
t.Start();
}
threadFactory.Create(task) creates (by using (with Ninject.Extensions.Factory) a system thread and injects in it sessionFactory and needed repositories and EQO (all using sessionFactory.GetCurrentSession() to access the session).
t.Start() triggers thread execution.
Thread's code is that in my original question.
Thanks.
Marcello.