/// <summary> /// Delete entities that implement iexpirablewithid and have expired based on server's system date /// </summary> /// <typeparam name="T">The type of entity</typeparam> /// <param name="session">Sessionwrapper instance to act upon</param> /// <returns></returns> internal static long DeleteExpirableWithId <T>(this SessionWrapper session) where T : IExpirableWithId { var ids = session.Query <T>() .Where(i => i.ExpireAt < session.Storage.UtcNow) .Select(i => i.Id) .ToList(); return(session.DeleteByInt32Id <T>(ids)); }
/// <summary> /// Delete entities that implement iexpirablewithid and have expired based on server's system date /// </summary> /// <typeparam name="T">The type of entity</typeparam> /// <param name="session">Sessionwrapper instance to act upon</param> /// <param name="cutOffDate"></param> /// <returns></returns> internal static long DeleteExpirableWithId <T>(this SessionWrapper session, DateTime cutOffDate) where T : IExpirableWithId { var ids = session.Query <T>() .Where(i => i.ExpireAt < cutOffDate) .Select(i => i.Id) .ToList(); return(session.DeleteByInt32Id <T>(ids)); }