I have an interface, called IRepository. One of the methods in this interface is:
IEnumerable<T> FindByQuery(Expression<Func<T, bool>> predicate);
I then have (for example) an IUserRepository, that implements IRepository.
In my implementation of IUserRepository, currently called LinqToSqlUserRepository, i have implemented the FindByQuery method like so:
public IEnumerable<PurchaseOrder> FindByQuery(Expression<Func<PurchaseOrder, bool>> predicate)
{
using (var db = new NavisionDataContext())
return db.PurchaseOrders.Where(predicate)
.ToList();
}
My question is, in the fullness of time, I intend to use nHibernate (or another ORM)
Would I be able to use Linq-To-Nhibernate to implement my method?