public void PublishCreditStandingChangedMessage(int customerId, bool creditStanding, string topic) { var message = new CreditStandingChangeMessage { ClientId = customerId, CreditStanding = creditStanding }; bus.Publish(message, topic); }
private void HandleCreditStanding(CreditStandingChangeMessage message) { using (var scope = provider.CreateScope()) { var services = scope.ServiceProvider; var customerRepos = services.GetService <IRepository <Customer> >(); var localCustomer = customerRepos.Get(message.ClientId); localCustomer.CreditStanding = message.CreditStanding; } }