I wrapped Nhibernate session as the following.
public interface IDalSession : IDisposable
{
void MarkForRollBack();
void End();
IDalSession Start();
IDalSession StartWithTransaction();
T Save<T>(T entity);
T CreateQuery<T>(string query);
//ISession GetHibernateSession { get; }
}
I really want to use QueryOver as my main query.
QueryOver API looks impossible to be wrapped because it is huge.
One solution is to use the NHibernate ISession (GetHibernateSession) in all of the places I need to pull data. but it is very ugliy.
What is the workaround here?
How can I wrap QueryOver?
Thanks
Is this what you mean?
You may get some comments about hiding away anything NH from other layers, so for that its fine to be able to pass back a new linq to NH query as its
IQueryable:but I personally prefer QueryOver API so I wrap my data access into concrete repositories. S#arp architecture does it nice: