What are the differences between Decorator, Wrapper and Adapter patterns? : <p>I feel like I've been using these pattern families quite many times, however, for me it's hard to see the differences as their <em>definitions</em> are quite similar. Basicaly it seems like all of them is about <em>wrapping</em> another object or objects to extend or <em>wrap</em> their behavior with extra stuff. </p>

<p>For a quick example implementing a caching mechanism over a repository pattern seems to be this situation. Here is a quick sample <code>C#</code> code I would probably start with.</p>

<pre><code>public interface IRepository {
  IEnumerable&lt;T&gt; GetItems&lt;T&gt;();
}

public class EntityFrameworkRepository : IRepository {
  ...
}

public class CachedRepository : IRepository {

  private IRepository _repository;
  private ICacheProvider _cache;

  public CachedRepository(IRepository repository, ICacheProvider cache) {
    this._repository = repository;
    this._cache = cache;
  }

  public IEnumerable&lt;T&gt; GetItems&lt;T&gt;() {
    ...
  }
}
</code></pre>

<p>Which one of these patterns apply to this situation for example? Could anyone clarify briefly the differences in theory and in practice?</p>
