Execution List

A simple way to build up a list of methods that will all be called at a specific point

I use this for 2 things:

  • to schedule tests on the data to be run just before a commit to the database, e.g. to assess data integrity
  • to make updates to repsonse data after a commit to the database, e.g. to return identity values set by the database


public interface IExecutionList : IList 
    void Execute();

public class ExecutionList : List, IExecutionList 
    public void Execute()
        this.ForEach(x => x());

private void Test(Container container)
    IExecutionList executionList = container.GetInstance();

    executionList.Add(() => Debug.Print("1"));
    executionList.Add(() => Debug.Print("2"));
    executionList.Add(() => Debug.Print("3"));
    executionList.Add(() => Debug.Print("4"));