public async Task Handle(AddOrderLine message, IMessageHandlerContext context) { using (var session = orm.OpenSession()) { var order = session.Get(message.OrderId); order.AddLine(message.Product, message.Quantity); session.Commit(); } }
public void Handle(AddOrderLine message) { using (var session = orm.OpenSession()) { var order = session.Get(message.OrderId); order.AddLine(message.Product, message.Quantity); session.Commit(); } }
public Task Handle(AddOrderLine message, IMessageHandlerContext context) { using (var session = orm.OpenSession()) { var order = session.Get(message.OrderId); if (!order.HasLine(message.LineId)) { order.AddLine(message.Product, message.Quantity); session.Commit(); } } return(Task.CompletedTask); }