views:

33

answers:

1

In linq2sql I had this code to implement base class for repository

    public abstract class Repository<T> : IRepository<T> where T : class {
        protected DataContext context;
        protected Table<T> table;

        public Repository (DataContext context)
        {
            this.context = context;
            table = context.GetTable<T> ();
        }

        public IQueryable<T> FindAll ()
        {
            return table;
        }

        public IQueryable<T> FindAll(Func<T, bool> exp)
        {
            return table.Where(exp).AsQueryable();
        }
}

Now I need to migrate to EF 4.0

Everything is fine and simple, BUT I can't find GetTable (or similar) method in ObjectContext

Thanks for help

+2  A: 

You're looking for CreateObjectSet<T>.

Julien Lebosquain