views:

64

answers:

1

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?

A: 

Why not? Linq to hibernate starts work deeper then this.

Sly