Skip to content

Instantly share code, notes, and snippets.

@explorer14
Last active November 17, 2018 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save explorer14/e8bd15f44876310bc8a600e93e762f47 to your computer and use it in GitHub Desktop.
Save explorer14/e8bd15f44876310bc8a600e93e762f47 to your computer and use it in GitHub Desktop.
namespace Domain
{
public class UseCase
{
private readonly IAdditionalDataA _serviceA;
private readonly IProductService _serviceB;
private readonly IAdditionalDataC _serviceC;
private readonly IAdditionalDataD _serviceD;
private readonly IAdditionalDataE _serviceE;
private readonly IAdditionalDataF _serviceF;
private readonly IPublisher _publisher;
public UseCase(
IAdditionalDataA serviceA,
IProductService serviceB,
IAdditionalDataC serviceC,
IAdditionalDataD serviceD,
IAdditionalDataE serviceE,
IAdditionalDataF serviceF,
IPublisher publisher)
{
_serviceA = serviceA;
_serviceB = serviceB;
_serviceC = serviceC;
_serviceD = serviceD;
_serviceE = serviceE;
_serviceF = serviceF;
_publisher = publisher;
}
public async Task Process()
{
var dataA = await _serviceA.GetDataA();
var products = await _serviceB.GetProducts(dataA);
var dataC = await _serviceC.GetDataC(dataA);
var dataD = await _serviceD.GetDataD(dataA);
var dataE = await _serviceE.GetDataE(dataA);
var dataF = await _serviceF.GetDataF(dataA);
foreach (var product in products)
{
product.CalculateReorderLevel(dataC, dataD, dataE, dataF);
await _publisher.Publish(product);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment