You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
821 B

using System;
using System.Collections.Generic;
using System.Text;
namespace Apewer.Web
{
/// <summary>Cron 特性。</summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class CronAttribute : Attribute
{
internal const int DefaultInterval = 60000;
private int _internval;
/// <summary>两次 Cron 执行的间隔毫秒数。</summary>
public int Interval
{
get { return _internval; }
private set { _internval = value < 1000 ? 1000 : value; }
}
/// <summary>创建 Cron 特性,可指定两次 Cron 执行的间隔毫秒数。</summary>
public CronAttribute(int interval = DefaultInterval)
{
Interval = interval;
}
}
}