code_junkie

Is this good design of a workflow-esque system

Nov 13th, 2011
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public override IEnumerable<WorkItem> Workflow() {
  2. // These would probably be injected from elsewhere
  3. var db = new DB();
  4. var emailServer = new EmailServer();
  5.  
  6. // other workitems here
  7.  
  8. var ci = new FindLowInventoryItems(db);
  9. yield return ci;
  10.  
  11. if (ci.LowInventoryItems.Any()) {
  12. var email = new SendEmailToWarehouse("Inventory is low.", ci.LowInventoryItems);
  13. yield return email;
  14. }
  15.  
  16. // other workitems here
  17. }
Add Comment
Please, Sign In to add comment