|
@@ -3,6 +3,8 @@ using System.Threading.Tasks;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web;
|
|
|
|
|
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
|
+
|
|
using GenHTTP.Api.Content;
|
|
using GenHTTP.Api.Content;
|
|
using GenHTTP.Api.Content.Templating;
|
|
using GenHTTP.Api.Content.Templating;
|
|
using GenHTTP.Api.Protocol;
|
|
using GenHTTP.Api.Protocol;
|
|
@@ -88,11 +90,11 @@ namespace Benchmarks.Tests
|
|
.Header("Content-Type", "text/html; charset=utf-8");
|
|
.Header("Content-Type", "text/html; charset=utf-8");
|
|
}
|
|
}
|
|
|
|
|
|
- private FortuneModel GetFortunes(IRequest request, IHandler handler)
|
|
|
|
|
|
+ private async ValueTask<FortuneModel> GetFortunes(IRequest request, IHandler handler)
|
|
{
|
|
{
|
|
using var context = DatabaseContext.CreateNoTracking();
|
|
using var context = DatabaseContext.CreateNoTracking();
|
|
|
|
|
|
- var fortunes = context.Fortune.ToList();
|
|
|
|
|
|
+ var fortunes = await context.Fortune.ToListAsync();
|
|
|
|
|
|
fortunes.Add(new Fortune() { Message = "Additional fortune added at request time." });
|
|
fortunes.Add(new Fortune() { Message = "Additional fortune added at request time." });
|
|
|
|
|
|
@@ -101,6 +103,12 @@ namespace Benchmarks.Tests
|
|
return new FortuneModel(request, handler, fortunes);
|
|
return new FortuneModel(request, handler, fortunes);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public async ValueTask PrepareAsync()
|
|
|
|
+ {
|
|
|
|
+ await Page.PrepareAsync();
|
|
|
|
+ await Template.PrepareAsync();
|
|
|
|
+ }
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|