Is the entity configured to use cache in its mapping?
RP
On Wednesday, November 19, 2014 4:35:23 PM UTC, Andrew wrote:
>
> Thanks guys for the reply.
>
> I add more information... This is a mvc application with controller,
> unitofwork, repository... Cache works fine... I make some test with this
> mapping:
>
> public class ArticlesMap:ClassMap<Articles>
> {
> Id(x=>x.Id);
> Map(x=>x.Tltle);
> Map(x=>x.Article).LazyLoad();
> }
>
> First page (where all works fine): show list of link (I use Id and Title
> columns):
>
> var list=_session.Query<Articles>().Cacheable().OrderBy(t=>t.Title).ToList
> ():
>
> When I call this page, the first time I see, with profiler, the query
> requested to database with two columns (Id and Title). If I refresh the
> page, it's used cache copy of these datas and there ins't requesto to
> database. Cool!
>
> Second page (where I have a problem). Page that show the article text:
>
> var article=_session.Query<Articles>(
> ).Cacheable().Where(t=>t.Id==1).SingleOrDefault();
>
> I call this page and I see query to request Article column from database
> when I show it in this page. Ok, lazyload works fine... BUT, when I refresh
> a page, nhibernate request again data to database. Why for the lazyload
> column cache doesn't work?
>
> Is there sole solution for this *problem*? Or, my *approach* to the
> problem is wrong? Make esier my question, how I can map table that
> contains columns to show only in list and big column to request only I want
> detail?
>
> Thanks
>
> Thanks
>
--
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.
For more options, visit https://groups.google.com/d/optout.