private void ProcessExpiredOrder() { //获取所有过期未支付的预订单 var expiredUnPayOrders = _orderQueryService.ExpiredUnPayOrders(); if (expiredUnPayOrders.Any()) { foreach (var expiredOrder in expiredUnPayOrders) { var command = new MarkAsExpiredCommand(expiredOrder.OrderId); _commandService.SendAsync(command); } } }
public void Handle(ICommandContext context, MarkAsExpiredCommand command) { context.Get <Order>(command.AggregateRootId).MarkAsExpire(); }