I have problem with the NHibernate's second level cache. When I use query:

var items1 = Session.Query<Row>()
    .Cacheable();
    .Fetch(x => x.Field)
    .OrderBy(x => x.Field.Value)
    .ToList();

Everything is fine - the query is cached. But when I want to use Dynamic 
Linq (a link):

var items2 = Session.Query<Row>()
    .Cacheable();
    .Fetch(x => x.Field)
    .OrderBy("Field.Value")
    .ToList();

The query is not cached. Interesting thing is that, when I delete code line:

    .Fetch(x => x.Field)

caching works again. So the problem is with using Fetch and dynamic linq 
OrderBy methods together.

The emitted query strings are the same (checked by log4net). There is a 
problem with identifying the query by NH. When I try do debug NH code 
(QueryKey class), debugger tells me that these two queries do not have the 
same ResultTransformer (and deeper: a listTransformation instance).

Any ideas?

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/D8PUxyvAVQAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to