public async Task <IRootModel> CalculateWithConverter(RootModelWithConverter model) { _logger.LogWarning("Starting calculation of {id}", model.Id); IRootModel result = await _calculator.Calculate(model); _logger.LogWarning("Finished calculation of {id}", model.Id); return(result); }
public async Task <IRootModel> Run(bool withConverter) { if (withConverter) { using (var client = new CalculateClient <RootModelWithConverter>(new Uri("http://localhost:5000"), new LoggerFactory())) { await client.ConnectAsync(); var model = new RootModelWithConverter { Id = 1, SubModel = new SubModel { Id = 2, Name = "Test", SampleNumber1 = 14, SampleNumber2 = 234 } }; IRootModel result = await client.CalculateWithConverter(model); return(result); } } else { using (var client = new CalculateClient <RootModel>(new Uri("http://localhost:5000"), new LoggerFactory())) { await client.ConnectAsync(); var model = new RootModel { Id = 3, SubModel = new SubModel { Id = 4, Name = "Test", SampleNumber1 = 564, SampleNumber2 = 464 } }; IRootModel result = await client.Calculate(model); return(result); } } }