Example #1
0
 public Ping()
 {
     pingSender.PingCompleted += new PingCompletedEventHandler(PingComplete);
     this.context              = new PingContext(this);
     this.context.Observer     = ObserverTrace.Instance(traceName);
     this.context.EndHandler  += new EventHandler <EventArgs>(StateMachineEnd);
     this.context.EnterInitialState();
     Reset();
 }
Example #2
0
        private static void ConfigureServices()
        {
            var services = new ServiceCollection();

            services.AddDbContext <PingContext>(options =>
                                                options.UseSqlServer(@"Server=(localdb)\MSSQLLocalDB;Database=Ping;Trusted_Connection=True;")
                                                , ServiceLifetime.Transient);

            services.AddScoped <ServiceFactory>(p => p.GetService);
            services.AddSingleton <Publisher>();
            services.AddTransient <INotificationHandler <Pinged>, AsyncPingedHandler>();
            services.AddTransient <INotificationHandler <Pinged>, FaultyPingedHandler>();
            services.AddTransient <INotificationHandler <Pinged>, AsyncPingedSupressTransactionHandler>();

            var provider = services.BuildServiceProvider();

            _publisher = provider.GetRequiredService <Publisher>();
            _dbContext = provider.GetRequiredService <PingContext>();
        }
Example #3
0
 public AsyncPingedHandler(PingContext context)
 {
     _context = context;
 }
Example #4
0
 public AsyncPingedSupressTransactionHandler(PingContext context)
 {
     _context = context;
 }