Skip to content

Commit a324090

Browse files
Fix platform Fortunes Dapper test (#2042)
1 parent cf5b6ee commit a324090

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

src/BenchmarksApps/TechEmpower/PlatformBenchmarks/BenchmarkApplication.Fortunes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ await RawDb.LoadFortunesRows(),
2424

2525
private async Task FortunesDapper(PipeWriter pipeWriter)
2626
{
27-
await OutputFortunes(pipeWriter, await DapperDb.LoadFortunesRows(), Templates.FortunesUtf8.Create);
27+
await OutputFortunes(pipeWriter, await DapperDb.LoadFortunesRows(), Templates.FortunesUtf16.Create);
2828
}
2929

3030
private async Task FortunesEf(PipeWriter pipeWriter)
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Threading.Tasks;
43
using Dapper;
54
using Npgsql;
65

7-
namespace PlatformBenchmarks
6+
namespace PlatformBenchmarks;
7+
8+
public sealed class DapperDb
89
{
9-
public sealed class DapperDb
10-
{
11-
private readonly string _connectionString;
10+
private readonly string _connectionString;
1211

13-
public DapperDb(AppSettings appSettings)
14-
=> _connectionString = appSettings.ConnectionString;
12+
public DapperDb(AppSettings appSettings)
13+
=> _connectionString = appSettings.ConnectionString;
1514

16-
public async Task<List<FortuneUtf16>> LoadFortunesRows()
17-
{
18-
List<FortuneUtf16> result;
15+
public async Task<List<FortuneUtf16>> LoadFortunesRows()
16+
{
17+
List<FortuneUtf16> result;
1918

20-
using (var db = new NpgsqlConnection(_connectionString))
21-
{
22-
// Note: don't need to open connection if only doing one thing; let dapper do it
23-
result = (await db.QueryAsync<FortuneUtf16>("SELECT id, message FROM fortune")).AsList();
24-
}
19+
using (var db = new NpgsqlConnection(_connectionString))
20+
{
21+
// Note: don't need to open connection if only doing one thing; let dapper do it
22+
result = (await db.QueryAsync<FortuneUtf16>("SELECT id, message FROM fortune")).AsList();
23+
}
2524

26-
result.Add(new FortuneUtf16(id: 0, message: "Additional fortune added at request time." ));
27-
result.Sort();
25+
result.Add(new FortuneUtf16(id: 0, message: "Additional fortune added at request time." ));
26+
result.Sort();
2827

29-
return result;
30-
}
28+
return result;
3129
}
3230
}

0 commit comments

Comments
 (0)