2018-10-28 15:03:59 +08:00
|
|
|
|
using Longbow.Cache;
|
|
|
|
|
using Longbow.Data;
|
2018-10-19 23:09:52 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrap.DataAccess
|
|
|
|
|
{
|
2018-10-28 15:03:59 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
2018-10-19 23:09:52 +08:00
|
|
|
|
public static class TaskHelper
|
|
|
|
|
{
|
2018-10-28 15:03:59 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public const string RetrieveTasksDataKey = "TaskHelper-RetrieveTasks";
|
2019-01-11 23:20:28 +08:00
|
|
|
|
|
2018-10-19 23:09:52 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询所有任务
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2019-01-11 23:20:28 +08:00
|
|
|
|
public static IEnumerable<Task> Retrieves() => CacheManager.GetOrAdd(RetrieveTasksDataKey, key => DbContextManager.Create<Task>().Retrieves());
|
2019-05-18 21:21:03 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存任务方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="task"></param>
|
|
|
|
|
/// <returns></returns>
|
2019-07-11 21:46:23 +08:00
|
|
|
|
public static bool Save(Task task) => DbContextManager.Create<Task>().Save(task);
|
2018-10-19 23:09:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|