public IActionResult Post(IFormCollection form) { (string name, Stream dataSourceStream) = ExtractData(form); var dataSource = _orchestrator.Initialize(name, User.Identity.Name, dataSourceStream); _tasksToRun.Enqueue(dataSource.Value); return(this.Result(Result <Guid> .Ok(dataSource.Value.Id))); }
/// <summary> /// The implementation of this interface method enqueus the action to be run on the custom /// task scheduler. The task scheduler runs asynchronously, however it has only one slot, that allows to maintain /// the order of execution for each of the items. /// </summary> public void SaveEntityStateAsyncAndDispose() { lock (Locker) { this.DetectChanges(); if (!TasksToRun.Any()) { var task = GetSaveTask(); TasksToRun.Enqueue(task); task.Start(); } else { TasksToRun.Enqueue(GetSaveTask()); } } }