using Longbow.Cache;
using Longbow.Data;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.DataAccess
{
///
///
///
public static class LogHelper
{
///
///
///
public const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs";
///
/// 查询所有日志信息
///
///
///
public static IEnumerable RetrieveLogs(string tId = null)
{
var ret = CacheManager.GetOrAdd(RetrieveLogsDataKey, key => DbAdapterManager.Create().RetrieveLogs(tId));
return string.IsNullOrEmpty(tId) ? ret : ret.Where(t => tId.Equals(t.Id.ToString(), StringComparison.OrdinalIgnoreCase));
}
///
/// 保存新增的日志信息
///
///
///
public static bool SaveLog(Log p) => DbAdapterManager.Create().SaveLog(p);
}
}