Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mike Chambers 636 posts 1253 karma points c-trib
    Apr 28, 2015 @ 14:52
    Mike Chambers
    0

    hasAccess causing database calls??

    Having updated a site to umb 6.2.5 I've started to use mini profiler.. and seeing lots of database calls for my menu builders.. investigation reveals that any call to HasAccess seems to cause a database hit... is that normal? Shouldn't front end this just be hitting the unbraco.config and access.config files?

    Here's what I've tried. Any pointers?

    foreach (var item in Model.Children)
            {
                if (Umbraco.Web.UmbracoHelper.MemberHasAccess(item.Id, item.Path))
                {
                    @item.Name <br />
                }
            } 
    foreach (var item in Model.Children)
            {
                if(item.HasAccess())
                {
                    @item.Name <br />
                }
            }
    foreach (var item in Model.Children.Where("hasAccess")
            {
                    @item.Name <br />
             
            }

     

Please Sign in or register to post replies

Write your reply to:

Draft