public virtual Task InsertExecutionInfoAsync(TaskExecutionInfo info)
        {
            Guard.NotNull(info, nameof(info));

            _db.TaskExecutionInfos.Add(info);
            return(_db.SaveChangesAsync());
        }
        public virtual Task DeleteExecutionInfoAsync(TaskExecutionInfo info)
        {
            Guard.NotNull(info, nameof(info));
            Guard.IsTrue(!info.IsRunning, nameof(info.IsRunning), "Cannot delete a running task execution info entry.");

            _db.TaskExecutionInfos.Remove(info);
            return(_db.SaveChangesAsync());
        }
        public virtual Task UpdateExecutionInfoAsync(TaskExecutionInfo info)
        {
            Guard.NotNull(info, nameof(info));

            try
            {
                _db.TryUpdate(info);
                return(_db.SaveChangesAsync());
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                // Do not throw.
                return(Task.CompletedTask);
            }
        }
Exemple #4
0
        public TaskExecutionContext(
            ITaskStore taskStore,
            HttpContext httpContext,
            IComponentContext componentContext,
            TaskExecutionInfo originalExecutionInfo)
        {
            Guard.NotNull(taskStore, nameof(taskStore));
            Guard.NotNull(httpContext, nameof(httpContext));
            Guard.NotNull(componentContext, nameof(componentContext));
            Guard.NotNull(originalExecutionInfo, nameof(originalExecutionInfo));

            _componentContext      = componentContext;
            _originalExecutionInfo = originalExecutionInfo;

            HttpContext   = httpContext;
            Parameters    = httpContext.Request.Query;
            TaskStore     = taskStore;
            ExecutionInfo = _originalExecutionInfo.Clone();
        }
Exemple #5
0
        public TaskExecutionContext(
            ITaskStore taskStore,
            HttpContext httpContext,
            IComponentContext componentContext,
            TaskExecutionInfo originalExecutionInfo,
            IDictionary <string, string> taskParameters = null)
        {
            Guard.NotNull(taskStore, nameof(taskStore));
            Guard.NotNull(httpContext, nameof(httpContext));
            Guard.NotNull(componentContext, nameof(componentContext));
            Guard.NotNull(originalExecutionInfo, nameof(originalExecutionInfo));

            _componentContext      = componentContext;
            _originalExecutionInfo = originalExecutionInfo;

            HttpContext   = httpContext;
            Parameters    = taskParameters ?? new Dictionary <string, string>();
            TaskStore     = taskStore;
            ExecutionInfo = _originalExecutionInfo.Clone();
        }