Beispiel #1
0
        static async Task Main(string[] args)
        {
            // configure logger
            string outputLog = string.Empty;

            if (args.Length > 1)
            {
                outputLog = args[1];
            }
            ConfigureLog(outputLog);

            // get config files
            if (!args.Any())
            {
                Log.Fatal("argument config filename not foud. please execute with argument filename config. ex: $ dotnet SfdcDataSync.dll RTContacts.json");
                return;
            }
            string configFile = args[0];

            // configure Ioc
            ServiceProvider serviceProvider = ConfigureIoC();

            // execute job
            ISqlAdapter   sqlAdapter   = serviceProvider.GetService <ISqlAdapter>();
            ISfdcAdapter  sfdcAdapter  = serviceProvider.GetService <ISfdcAdapter>();
            IResultLogger resultLogger = serviceProvider.GetService <IResultLogger>();
            JobExecutor   executor     = new JobExecutor(sqlAdapter, sfdcAdapter, resultLogger);

            try
            {
                await executor.ExecuteAsync(configFile);
            }
            catch (Exception ex)
            {
                Log.Fatal("error on executing job", ex);
            }
        }
Beispiel #2
0
 public JobExecutor(ISqlAdapter sqlAdapter, ISfdcAdapter sfdcAdapter, IResultLogger resultLogger)
 {
     _sqlAdapter   = sqlAdapter;
     _sfdcAdapter  = sfdcAdapter;
     _resultLogger = resultLogger;
 }