c# - How can I load everything up in nhibernate 2nd level cache? -


i have asp.net-mvc site using nhibernate , sql server, there few pages quite slow because require view need queries join 25 different tables. if don't large join takes while , if multi query still seems take while

its pretty ready heavy (light write) db wanted see if there way load entire object graph of database (my server has plenty of memory) 2nd level cache confident hits db. using

  nhibernate.caches.syscache.syscacheprovider 

as second level cache (not distributed cache). there flaw in idea , there recommended way of doing this?

you caching query results, not entity (those separate caches) caching query's results stores ids; if not caching entities too, query issued load each returned entity (this bad) default table name mydto class mydto, that's it's looking looks query id, shouldn't using loose named query, proper loader .(see 17.4. custom sql loading) once set loader , entity caching, you'll able retrieve objects using session.get(id), use second level cache, long of work inside transactions, recommended practice.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -