重构代码:更改Count() > 0 为 Any() 优化性能
This commit is contained in:
parent
441e41dc85
commit
8f32a12e4e
|
@ -21,7 +21,7 @@ namespace Bootstrap.Admin
|
||||||
{
|
{
|
||||||
if (operation.Parameters == null) operation.Parameters = new List<IParameter>();
|
if (operation.Parameters == null) operation.Parameters = new List<IParameter>();
|
||||||
|
|
||||||
if (context.MethodInfo.GetCustomAttributes(typeof(AllowAnonymousAttribute), true).Count() == 0)
|
if (context.MethodInfo.GetCustomAttributes(typeof(AllowAnonymousAttribute), true).Length == 0)
|
||||||
{
|
{
|
||||||
operation.Parameters.Add(new NonBodyParameter()
|
operation.Parameters.Add(new NonBodyParameter()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@model Bootstrap.Security.BootstrapMenu
|
@model Bootstrap.Security.BootstrapMenu
|
||||||
<li class="nav-item @Model.Active">
|
<li class="nav-item @Model.Active">
|
||||||
<a href="@Url.Content(Model.Url)" class="nav-link @Model.Active" target="@Model.Target"><i class="@Model.Icon"></i>@Model.Name</a>
|
<a href="@Url.Content(Model.Url)" class="nav-link @Model.Active" target="@Model.Target"><i class="@Model.Icon"></i>@Model.Name</a>
|
||||||
@if (Model.Menus.Count() > 0)
|
@if (Model.Menus.Any())
|
||||||
{
|
{
|
||||||
@await Html.PartialAsync("SubNavigation", Model.Menus)
|
@await Html.PartialAsync("SubNavigation", Model.Menus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<div class="navbar-nav">
|
<div class="navbar-nav">
|
||||||
@foreach (var menu in Model.Navigations)
|
@foreach (var menu in Model.Navigations)
|
||||||
{
|
{
|
||||||
@if (menu.Menus.Count() > 0)
|
@if (menu.Menus.Any())
|
||||||
{
|
{
|
||||||
<div class="nav-item dropdown @menu.Active">
|
<div class="nav-item dropdown @menu.Active">
|
||||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" href="#">@menu.Name</a>
|
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" href="#">@menu.Name</a>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@model Bootstrap.Security.BootstrapMenu
|
@model Bootstrap.Security.BootstrapMenu
|
||||||
<li class="nav-item @Model.Active">
|
<li class="nav-item @Model.Active">
|
||||||
<a href="@Url.Content(Model.Url)" class="nav-link @Model.Active" target="@Model.Target"><i class="@Model.Icon"></i>@Model.Name</a>
|
<a href="@Url.Content(Model.Url)" class="nav-link @Model.Active" target="@Model.Target"><i class="@Model.Icon"></i>@Model.Name</a>
|
||||||
@if (Model.Menus.Count() > 0)
|
@if (Model.Menus.Any())
|
||||||
{
|
{
|
||||||
@await Html.PartialAsync("SubNavigation", Model.Menus)
|
@await Html.PartialAsync("SubNavigation", Model.Menus)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue