コード例 #1
0
        private static ScheduledTask GetByIdWithTags(int id, IDbConnection db, IDbTransaction t)
        {
            const string  sql  = @"
SELECT ScheduledTask.*, ScheduledTask_Tag.Name FROM ScheduledTask
LEFT JOIN ScheduledTask_Tags ON ScheduledTask_Tags.ScheduledTaskId = ScheduledTask.Id
LEFT JOIN ScheduledTask_Tag ON ScheduledTask_Tags.TagId = ScheduledTask_Tag.Id
WHERE ScheduledTask.Id = @Id
ORDER BY ScheduledTask_Tag.Name ASC
";
            ScheduledTask task = null;

            db.Query <ScheduledTask, string, ScheduledTask>(sql, (s, tag) =>
            {
                task = task ?? s;
                if (tag != null)
                {
                    task.Tags.Add(tag);
                }
                return(task);
            }, new { Id = id }, splitOn: "Name", transaction: t);

            return(task);
        }
コード例 #2
0
 public static void RepeatIndefinitely(this ScheduledTask task, string expression)
 {
     task.Expression = expression;
 }
コード例 #3
0
 public static void RepeatUntil(this ScheduledTask task, string expression, DateTimeOffset end)
 {
     task.Expression = expression;
     task.End        = end;
 }