Here is what our main.cs looks like when completed. You will notice that this is quite different from the other main files we have created in that we are also dealing with the Quartz scheduler as well:
static void Main(string[] args)
{
var builder = new ContainerBuilder();
// Service itself
builder.RegisterType<SchedulingMicroService>()
.AsImplementedInterfaces()
.AsSelf()
?.InstancePerLifetimeScope();
builder.RegisterType<Logger>().SingleInstance();
var container = builder.Build();
XmlConfigurator.ConfigureAndWatch(new FileInfo(@".log4net.config"));
HostFactory.Run(c =>
{
c?.UseAutofacContainer(container);
c?.UseLog4Net();
c?.ApplyCommandLineWithDebuggerSupport();
c?.EnablePauseAndContinue();
c?.EnableShutdown();
c?.OnException(ex => { Console.WriteLine(ex.Message); });
// Here is the main difference in this Microservice. We are going to run the Quartz scheduler...