System.Timers.Timer t = new System.Timers.Timer(300000);
t.Elapsed += new System.Timers.ElapsedEventHandler((s, e) => Arbitration(s, e, orderId));
t.AutoReset = false;
t.Enabled = true;
public void Arbitration(object source,ElapsedEventArgs e,long orderId)
{
var model = context.OrderCancelInfo.FirstOrDefault(c => c.BizOrdersId == orderId);
if (model.Status == 0)
{
model.Status = 3;
model.Remarks = "暂无回应";
}
context.SaveChanges();
}
五分钟内数据有过更新,自动执行时查询出来的还是未更新的数据,请问怎么解决
using(context)
{
//TODO Sth
}
System.Timers.Timer t = new System.Timers.Timer(300000);
弄成静态.不然会被释放.
PS:https://github.com/wrx362114/EasyMQService
private static System.Timers.Timer time;
是这样吗 好像也不行呀
@程序猿鼓励师: 那你先找原因吧.打日志.你只写了这一段没有写宿主.
而且定时任务也不这么搞.都用qz的