Esempio n. 1
0
        public ContactsSubscription(SubscriptionClient subscriptionClient, string dbConnectionString)
        {
            this.subscriptionClient = subscriptionClient;

            this.options = OptionsFactory.NewDbOptions <CommunicationsContext>(dbConnectionString);

            this.handlers = new Dictionary <Type, Action <string, CommunicationsContext> >()
            {
                {
                    typeof(ContactCreatedEventNotification),
                    (notificationJson, context) => {
                        var notificationEvent = JsonConvert.DeserializeObject <ContactCreatedEventNotification>(notificationJson);
                        var handler           = new ContactCreatedHandler(context);
                        handler.Handle(notificationEvent).Wait();
                    }
                },
                {
                    typeof(ContactRemovedEventNotification),
                    (notificationJson, context) => {
                        var notificationEvent = JsonConvert.DeserializeObject <ContactRemovedEventNotification>(notificationJson);
                        var handler           = new ContactRemovedHandler(context);
                        handler.Handle(notificationEvent).Wait();
                    }
                }
            };
        }
Esempio n. 2
0
 public SendCommunicationSubscription(QueueClient queueClient, string dbConnectionString)
 {
     this.queueClient = queueClient;
     this.options     = OptionsFactory.NewDbOptions <CommunicationsContext>(dbConnectionString);
 }
 public NotificationPublisher(string dbConnectionString, string serviceBusConnectionString, string topicName)
 {
     this.topicName = topicName;
     this.serviceBusConnectionString = serviceBusConnectionString;
     this.options = OptionsFactory.NewDbOptions <ContactsContext>(dbConnectionString);
 }