I thought that you just had to wrap it in SessionScope, and
SessionScope is enabled for the full httprequest using the httpmodule

However, just to be safe, I wrapped it in a transaction:

            Category[] defaultCategories;
            using (new TransactionScope(OnDispose.Commit))
            {
                defaultCategories = Category.FindAll();
            }

However, I still get the multiple db calls.


On Feb 3, 4:23 pm, Stefan Sedich <[email protected]> wrote:
> Do you not need to wrap your call to get all in a transaction? I
> thought second level cache was only commited on commit of a
> transaction?
>
> Cheers
> Stefan
>
>
>
> On Wed, Feb 4, 2009 at 10:15 AM, jasonsirota <[email protected]> wrote:
>
> > After wrestling with the trunk version of ActiveRecord and NHibernate
> > and NH-Contrib version numbers I finally got cache support enabled for
> > the AR project, however I'm having trouble getting it to work.
>
> > The call is something like:
>
> > Category.FindAll(new Order("SortOrder"),true)
>
> > which returns a list of category sorted by the db field "SortOrder".
>
> > I've enabled caching on the Category object like:
>
> > [ActiveRecord("Categories", Cache=CacheEnum.ReadOnly)]
> > public class Category
> > ...
>
> > However, each time the page loads, it requeries the database instead
> > of pulling the resulting list from the cache.
>
> > SELECT this_.CategoryID as CategoryID4_0_, this_.Description as
> > Descript2_4_0_, this_.SortOrder as SortOrder4_0_, this_.Type as
> > Type4_0_ FROM BudgeterCategories this_ ORDER BY this_.SortOrder asc
>
> > Any ideas?
> > Jason
>
> --
> Stefan Sedich
> Software Developerhttp://weblogs.asp.net/stefansedich
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to