Repository for data retrieval I have created a really simple repository for some simple data retrieval and was wondering if i was going in the right direction.  Has anyone got any thoughts on this?

interface

public interface IRepository&lt;T&gt; where T : class {
    IEnumerable&lt;T&gt; GetAll();
    T GetById(int id);
    IEnumerable&lt;T&gt; Filter(Expression&lt;Func&lt;T, bool&gt;&gt; filter);
    void Dispose();
}    


class

public class JobRepository : IRepository&lt;Job&gt;, IDisposable{
    /// &lt;summary&gt;
    /// handles all job data retrieval
    /// crude but will suffice for now
    /// &lt;/summary&gt;
    CentralRepositoryContainer _context = null;

    public JobRepository() {
        CentralRepositoryContainer context =
            HttpContext.Current.GetCentralRepositoryContext();
    }

    /// &lt;summary&gt;
    /// returns all jobs
    /// &lt;/summary&gt;
    /// &lt;returns&gt;IEnumerable&lt;Job&gt;&lt;/returns&gt;
    public IEnumerable&lt;Job&gt; GetAll() {
        try {
            return this._context.Jobs;
        } catch (SqlException ex) {
            //error so dispose of context
            this.Dispose();
            //wrap and rethrow back to caller
            throw new CentralRepositoryException("Error getting all jobs", ex);
        }

    }

    /// &lt;summary&gt;
    /// return job
    /// &lt;/summary&gt;
    /// &lt;param name="id"&gt;integer to search on&lt;/param&gt;
    /// &lt;returns&gt;job&lt;/returns&gt;
    public Job GetById(int id) {
        try {
            return this._context.Jobs.SingleOrDefault(j =&gt; j.JobId == id);
        } catch (SqlException ex) {
            //error so dispose of context
            this.Dispose();
            //wrap and rethrow back to caller
            throw new CentralRepositoryException("Error getting all job by id", ex);
        }
    }

    /// &lt;summary&gt;
    /// filters based on parsed filter expression
    /// &lt;/summary&gt;
    /// &lt;param name="filter"&gt;filter to search on&lt;/param&gt;
    /// &lt;returns&gt;IQueryable&lt;Job&gt;&lt;/returns&gt;
    public IEnumerable&lt;Job&gt; Filter(System.Linq.Expressions.Expression&lt;Func&lt;Job, bool&gt;&gt; filter) {
        try {
            return this._context.Jobs.Where(filter);
        } catch (SqlException ex) {
            //error so dispose of context
            this.Dispose();
            //wrap and rethrow back to caller
            throw new CentralRepositoryException("Error getting all job by filter", ex);
        }
    }

    public void Dispose() {
        if (this._context != null) {
            this._context.Dispose();    
        }
    }
}
Especially in such simple cases you don't want to create a repository over an EF (I assume it's EF -- but the same goes for Linq2SQL) context. 

The DbContext basically is an implementation of the repository pattern. Your repository on top just creates another layer of complexity without actually providing any serious benefit.

In more complicated cases wrapping the DbContext with a specific interface may make sense of course.