Ricardo,

I'm against IQueryable extension methods by the couple of reasons:

1. These extension methods can be called at any place of the query and this
may lead to confusions, for example:

var q = (from c in session.Query<Customer>().SetLockMode(LockMode.Update)
from o in c.Orders
select new { c, o }).ToList()

does this option apply to preceding part or to a whole query?

Or what if we apply different lock modes to Customers and Orders?

var q = (from c in session.Query<Customer>().SetLockMode(LockMode.Update)
from o in c.Orders.SetLockMode(LockMode.Read)
select new { c, o }).ToList()

2. They make query harder to process, because they create "Result
Transformers" that need to be removed, and also ReLinq creates subqueries
in such cases, etc.

Best Regards,
Alexander


2014-08-19 23:12 GMT+12:00 Ricardo Peres <rjpe...@gmail.com>:

> Alex,
>
> I feel exactly the opposite! :-( I prefer having extension methods, I
> think the code is much more fluent. Also, there are already extension
> methods like this (cache, timeout, etc).
>
> RP
>
>
> On Tuesday, August 19, 2014 6:24:54 AM UTC+1, cremor wrote:
>>
>> I'd stay as fluent as possible, so my vote is for option 3. But I still
>> like extension methods more. There are already extension methods for
>> fetching, so why create something different?
>>
>> And Entity Framework also does it with extension methods, so the API
>> would be similar for both frameworks.
>>
>>
>> On Tuesday, August 19, 2014 5:23:10 AM UTC+2, Alexander Zaytsev wrote:
>>>
>>> Hi guy,
>>>
>>> There are some demand to add ability tune LINQ queries with different
>>> options, as readonly, lock modes, time outs, etc (NH-2285, NH-3470)
>>>
>>> All of them are about to add extension methods for IQueryable. I do not
>>> like this, and I have a proposal:
>>>
>>> What if we will have an argument on session.Query methods which will
>>> accept the query options:
>>>
>>>
>>> session.Query<Customer>(new QueryOptions { ReadOnly = true }).Where(c => 
>>> /*...*/)
>>>
>>> or with lambdas
>>>
>>> session.Query<Customer>(c => { c.ReadOnly = true; }).Where(c => /*...*/)
>>>
>>> or
>>>
>>> session.Query<Customer>(c => c.ReadOnly()).Where(c => /*...*/)
>>>
>>> What do you think?
>>>
>>> Best Regards,
>>> Alexander
>>>
>>  --
>
> ---
> 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.
>

-- 

--- 
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