DimerceDemoApplication/Program.cs

31 lines
1 KiB
C#
Raw Permalink Normal View History

2023-01-06 15:08:26 +00:00
using DTO;
using static Configuration.ApplicationConfigurationService;
namespace OrderParser
2023-01-04 12:41:53 +00:00
{
class Program
{
static void Main(string[] args)
{
try
{
2023-01-06 15:08:26 +00:00
var filesInfoConfig = Configuration.ApplicationConfigurationService.InitializeFrom(args);
var csvFileWriter = new CsvFileWriterService(filesInfoConfig.OutputFile);
foreach (var jsonFile in filesInfoConfig.JsonFilesInfo)
{
2023-01-06 15:08:26 +00:00
// Could have easily been another service, but only do that when it needs to be scaled.
2023-01-04 22:32:29 +00:00
var orderDTO = Newtonsoft.Json.JsonConvert.DeserializeObject<OrderDto>(File.ReadAllText(jsonFile.FullName));
var orderModel = new OrderModel(orderDTO);
csvFileWriter.writeOutRow(orderModel);
}
}
catch (DemoApplicationConfigurationException e)
{
Console.WriteLine(e.Message);
}
2023-01-04 12:41:53 +00:00
}
}
}