コード例 #1
0
        public void PublishCreditStandingChangedMessage(int customerId, bool creditStanding, string topic)
        {
            var message = new CreditStandingChangeMessage
            {
                ClientId       = customerId,
                CreditStanding = creditStanding
            };

            bus.Publish(message, topic);
        }
コード例 #2
0
        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;
            }
        }