Migration from linq2sql to EF4.0
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
Eve开发者_开发知识库rything is fine and simple, BUT I can't find GetTable (or similar) method in ObjectContext
Thanks for help
You're looking for CreateObjectSet<T>
.
精彩评论