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 System.Threading.Tasks;
......@@ -16,14 +16,13 @@ public void Setup()
}
[Benchmark(Description = "ExecuteReader")]
public async Task ExecuteReader()
public Post ExecuteReader()
{
Step();
// TODO: How do you get a Post out of this thing?
await _mapper.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + i,
var post = new Post();
_mapper.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + i,
reader =>
{
var post = new Post();
post.Id = reader.GetInt32(0);
post.Text = reader.GetString(1);
post.CreationDate = reader.GetDateTime(2);
......@@ -39,6 +38,7 @@ public async Task ExecuteReader()
post.Counter8 = reader.IsDBNull(11) ? null : (int?)reader.GetInt32(11);
post.Counter9 = reader.IsDBNull(12) ? null : (int?)reader.GetInt32(12);
});
return post;
}
}
}
\ No newline at end of file
}
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