SHARE
TWEET

Untitled

a guest May 25th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. internal class Program
  2.     {
  3.         private static void Main(string[] args)
  4.         {
  5.             var services = new ServiceCollection();
  6.  
  7.             var serviceProvider = Bootstrapper.GetServiceProvider(services);
  8.  
  9.  
  10.             HostFactory.Run(configurator =>
  11.             {
  12.                 configurator.SetServiceName("InvoiceProcessingService");
  13.                 configurator.SetDisplayName("InvoiceProcessingService");
  14.                 configurator.SetDescription("InvoiceProcessingService");
  15.  
  16.                 configurator.RunAsLocalSystem();
  17.  
  18.                 configurator.Service<InvoiceService>(serviceConfigurator =>
  19.                 {
  20.                     var jobFactory = serviceProvider.GetRequiredService<IJobFactory>();
  21.  
  22.                     serviceConfigurator.ConstructUsing(() => new InvoiceService(jobFactory));
  23.  
  24.                     serviceConfigurator.WhenStarted((service, hostControl) =>
  25.                     {
  26.                         service.OnStart();
  27.                         return true;
  28.                     });
  29.                     serviceConfigurator.WhenStopped((service, hostControl) =>
  30.                     {
  31.                         service.OnStop();
  32.                         return true;
  33.                     });
  34.                 });
  35.             });
  36.         }
  37.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top