title: What Design Pattern to use to implement transaction or chaining mechanism
body: <p>I implemented a simple Factory class in C# and Java. This class builds instances of concrete working classes that have one and the same interface. In particular all these classes have such methods as:</p>
  
  <pre><code>create
  select
  alter
  etc.
  </code></pre>
  
  <p>Now I want to have a mechanism (built on top of some classical/non-classical Pattern) that will allow me to create "chains" of these methods or to encapsulate them in a kind of transaction. In a pseudo-code I expect to see something like:</p>
  
  <pre><code>Transaction tnx = create(...args...).alter(...args_2...);
  //tnx.Execute();
  </code></pre>
  
  <p>Or something like:</p>
  
  <pre><code>Transaction tnx;
  tnx.Start();
  tnx.Add(method_name, ... variable list of arguments ...);
  tnx.Add(another_method_name, ... variable list of arguments ...);
  tnx.Execute();
  </code></pre>
  
  <p>I'm not that good at design patterns and I'm not sure what pattern to use. I hope someone can share and drop a couple of lines of code (in C# or in Java) that will demonstrate how this can be implemented. Thanks!</p>