static void Main(string[] args)
        {
            var serviceBusConnectionString =
                ConfigurationManager.AppSettings["serviceBusConnectionString"];

            ServiceBusHelper.ServiceBus
                .Setup(serviceBusConnectionString, "sitemonitr")
                .Subscribe<SitePingResult>((result) =>
                    {
                        var context = new SitePingDataContext();
                        context.SitePingResults.Add(result);
                        context.SaveChanges();

                        var output = string.Format("Site {0} is {1} at {2} saved to database",
                            result.Url, result.Status, result.TimeStamp);
                        Console.WriteLine(output);
                    });
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var serviceBusConnectionString =
                ConfigurationManager.AppSettings["serviceBusConnectionString"];

            ServiceBusHelper.ServiceBus
            .Setup(serviceBusConnectionString, "sitemonitr")
            .Subscribe <SitePingResult>((result) =>
            {
                var context = new SitePingDataContext();
                context.SitePingResults.Add(result);
                context.SaveChanges();

                var output = string.Format("Site {0} is {1} at {2} saved to database",
                                           result.Url, result.Status, result.TimeStamp);
                Console.WriteLine(output);
            });
        }