using Longbow.Cache;
using Longbow.Data;
using Longbow.Web.Mvc;
using PetaPoco;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Bootstrap.DataAccess
{
///
///
///
public static class ExceptionsHelper
{
///
///
///
public const string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
///
///
///
///
///
///
public static void Log(Exception ex, NameValueCollection additionalInfo)
{
var ret = DbContextManager.Create().Log(ex, additionalInfo);
if (ret) CacheManager.Clear(RetrieveExceptionsDataKey);
}
///
/// 查询一周内所有异常
///
///
public static IEnumerable Retrieves() => CacheManager.GetOrAdd(RetrieveExceptionsDataKey, key => DbContextManager.Create().Retrieves());
///
///
///
///
///
///
///
public static Page RetrievePages(PaginationOption po, DateTime? startTime, DateTime? endTime) => DbContextManager.Create().RetrievePages(po, startTime, endTime);
}
}