I am developing a system that will allow me to present wide-scope tasks as workflows that expose their work items using the IEnumerable method. The goal is to use the C # 'yield' mechanism to allow me to write pseudo-process code that the workflow runtime system can execute as it sees fit.
For example, let's say I have a workflow that involves running a query in a database and sending an email alert if the query returns a specific result. This may be a workflow:
public override IEnumerable<WorkItem> Workflow() {
var db = new DB();
var emailServer = new EmailServer();
var ci = new FindLowInventoryItems(db);
yield return ci;
if (ci.LowInventoryItems.Any()) {
var email = new SendEmailToWarehouse("Inventory is low.", ci.LowInventoryItems);
yield return email;
}
}
CheckInventory EmailWarehouse - , WorkItem, Execute(), , . Execute() - WorkflowRunner, Workflow(), - - Execute . , , , , ..
, , , , , , . , IEnumerable #, , - , , - . , , .
, , ? , - ( , , ), ( ), .. - , ? , - ?