Exemple #1
0
        /// <summary>
        /// Loads - if not already loaded - the last <see cref="TaskExecutionInfo"/> object instance for a task from the store
        /// and assigns data to <see cref="TaskDescriptor.LastExecution"/>.
        /// </summary>
        /// <param name="task">The task to load data for.</param>
        /// <param name="force"><c>true</c> always enforces a reload, even if data is loaded already.</param>
        public static async Task LoadLastExecutionInfoAsync(this ITaskStore store, TaskDescriptor task, bool force = false)
        {
            Guard.NotNull(task, nameof(task));

            if (task.LastExecution == null || force)
            {
                task.LastExecution = await store.GetLastExecutionInfoByTaskAsync(task);
            }
        }