You mean querying first level cache entities?

If so, try this extension method:

public static IEnumerable<T> Local<T>(this ISession session)
{
        ISessionImplementor impl = session.GetSessionImplementation();
        IPersistenceContext persistence = impl.PersistenceContext;
 
        return (persistence.EntityEntries.Keys.OfType<T>());
}


Use like this:

var c = session.Local<Customer>().Where(x => x.Name == "ricardo").ToList();


RP



On Wednesday, May 29, 2013 5:19:03 PM UTC+1, Patric Forsgard wrote:
>
> Hi.
>
> Is it possible to get Linq queries transformed on the same way as 
> ICriteria to find entities on natural key without going to database?
>
> Regarding to ayende's blog 
> http://ayende.com/blog/4061/nhibernate-natural-id the query that is 
> generated is the same as using equal. The different I found is when code is 
> asking query-cache the naturalId-parameter is always false for linq-queries.
>
> Using NHibernate version 3.3.3.
>
> // Patric
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to