forked from aspnet/Mvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding helper extensions from aspnet/Razor#715 (comment)
- Loading branch information
Showing
5 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/HelperExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Html; | ||
using Microsoft.AspNetCore.Mvc.Razor; | ||
|
||
public static class HelperExtensions | ||
{ | ||
public static Func<T1, IHtmlContent> Helper<T1>( | ||
this RazorPageBase page, | ||
Func<T1, Func<object, IHtmlContent>> helper | ||
) => p1 => helper(p1)(null); | ||
|
||
public static Func<T1, T2, IHtmlContent> Helper<T1, T2>( | ||
this RazorPageBase page, | ||
Func<T1, T2, Func<object, IHtmlContent>> helper | ||
) => (p1, p2) => helper(p1, p2)(null); | ||
|
||
public static Func<T1, T2, T3, IHtmlContent> Helper<T1, T2, T3>( | ||
this RazorPageBase page, | ||
Func<T1, T2, T3, Func<object, IHtmlContent>> helper | ||
) => (p1, p2, p3) => helper(p1, p2, p3)(null); | ||
} |
10 changes: 10 additions & 0 deletions
10
benchmarks/Microsoft.AspNetCore.Mvc.Performance.Views/Views/HelperExtensions.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@using System; | ||
@using Microsoft.AspNetCore.Html | ||
@model System.String | ||
@{ | ||
var SomeHelper = this.Helper((string s) => @<text>@item</text>); | ||
} | ||
@for (var i = 0; i < 100; i++) | ||
{ | ||
@SomeHelper(Model + i.ToString()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters