Commit e7ba3054 authored by Jovan Popovic's avatar Jovan Popovic Committed by Marc Gravell

Configured Belgrade Sql client to return data (#1066)

parent cd751c21
using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Attributes;
using Belgrade.SqlClient.SqlDb; using Belgrade.SqlClient.SqlDb;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -16,14 +16,13 @@ public void Setup() ...@@ -16,14 +16,13 @@ public void Setup()
} }
[Benchmark(Description = "ExecuteReader")] [Benchmark(Description = "ExecuteReader")]
public async Task ExecuteReader() public Post ExecuteReader()
{ {
Step(); Step();
// TODO: How do you get a Post out of this thing? var post = new Post();
await _mapper.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + i, _mapper.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + i,
reader => reader =>
{ {
var post = new Post();
post.Id = reader.GetInt32(0); post.Id = reader.GetInt32(0);
post.Text = reader.GetString(1); post.Text = reader.GetString(1);
post.CreationDate = reader.GetDateTime(2); post.CreationDate = reader.GetDateTime(2);
...@@ -39,6 +38,7 @@ public async Task ExecuteReader() ...@@ -39,6 +38,7 @@ public async Task ExecuteReader()
post.Counter8 = reader.IsDBNull(11) ? null : (int?)reader.GetInt32(11); post.Counter8 = reader.IsDBNull(11) ? null : (int?)reader.GetInt32(11);
post.Counter9 = reader.IsDBNull(12) ? null : (int?)reader.GetInt32(12); post.Counter9 = reader.IsDBNull(12) ? null : (int?)reader.GetInt32(12);
}); });
return post;
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment