This is a migrated thread and some comments may be shown as answers.

Constructor calls from Menu?

1 Answer 53 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Caecilia
Top achievements
Rank 1
Caecilia asked on 12 Mar 2018, 05:28 PM

Hi,I have something like this in my _LayoutStandard.html for an ASP.NET MVC5 site:

@(Html.Kendo().Menu().Name("tdtMenu").Items(lvl1 =>
{
  lvl1.Add()
      .ImageUrl(Url.Content("~/Content/Images/tools.png"))
      .Items(lvl2 =>
      {
          lvl2.Add().Text("Server info").Action("About", "Foo");
          lvl2.Add().Text("Change my password").Action("Manage", "Account");
          lvl2.Add().Text("Administration").Action("Index", "Admin");
          lvl2.Add().Text("Testpages").Items(lvl3 =>
          {
              lvl3.Add().Text("Testpage - Fitting").Action("FittingTest", "Fitting");
              lvl3.Add().Text("Testpage - SignalR").Action("Index", "Foo");
              lvl3.Add().Text("Testpage - Obsolete").Action("Project", "Overview");
          });
          lvl2.Add().Text("Projects").Action("Overview", "Project");
      });
}).Events(e => e.Select("TDT.MenuSelect")))

 

I have noticed, that the Action() calls lead to calling the controller constructors. Why is that? Isn't that a performance issue?

Thank you for more information on this!

1 Answer, 1 is accepted

Sort by
0
Caecilia
Top achievements
Rank 1
answered on 13 Mar 2018, 01:03 PM
Turns out, it's the default active security trimming feature of the the Kendo menu, which leads to calling each controller constructor to determine whether the user is authorized to access the menu item. Turning this off with .SecurityTrimming(false) to not have the behaviour. Cheers!
Tags
Menu
Asked by
Caecilia
Top achievements
Rank 1
Answers by
Caecilia
Top achievements
Rank 1
Share this question
or