Hi,

I submitted a pull request for https://nhibernate.jira.com/browse/NH-2140. 
The idea is to have all query APIs (LINQ, HQL, SQL, Criteria and QueryOver) 
support a base interface, which I called IQueryOptions.
This interface has common methods for paging, limiting the number of 
records, setting read only, setting lock mode, setting a result 
transformer, queuing to future queries, and performing the actual query. It 
is defined as:

public interface IQueryOptions
{
        IList List();
 
        void List(IList list);
 
        IList<T> List<T>();
 
        object UniqueResult();
 
        T UniqueResult<T>();
 
        IQueryOptions SetFirstResult(int firstResult);
 
        IQueryOptions SetFetchSize(int fetchSize);
 
        IQueryOptions SetReadOnly(bool readOnly);
 
        IQueryOptions SetCacheable(bool cacheable);
 
        IQueryOptions SetCacheRegion(string cacheRegion);
 
        IQueryOptions SetTimeout(int timeout);
 
        IQueryOptions SetMaxResults(int maxResults);
 
        IQueryOptions SetLockMode(string alias, LockMode lockMode);
 
        IQueryOptions SetResultTransformer(IResultTransformer 
resultTransformer);
 
        IFutureValue<T> FutureValue<T>();
 
        IEnumerable<T> Future<T>();
}


Because it was required for LINQ, I also included 
https://nhibernate.jira.com/browse/NH-3299, 
https://nhibernate.jira.com/browse/NH-3470 
and https://nhibernate.jira.com/browse/NH-2285.
It allows doing these without caring what API is actually being used:

IQueryOptions query = //...

query = query.SetReadOnly(true);
query = query.SetFirstResult(1);
query = query.SetMaxResults(1);
query = query.SetFetchSize(100);
query = query.SetLockMode(alias, LockMode.Upgrade);
query = query.SetResultTransformer(transformer);
 var result = query.List<Simple>();


What do you think? Let me hear your comments.


RP

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhibernate-development+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to