Skip to content

Instantly share code, notes, and snippets.

@explorer14

explorer14/Usecase.cs

Last active Nov 17, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.