mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-18 22:31:08 +08:00
29 lines
717 B
C#
29 lines
717 B
C#
using BenchmarkDotNet.Attributes;
|
|
using ServiceStack.OrmLite;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
|
|
namespace Dapper.Tests.Performance
|
|
{
|
|
[Description("ServiceStack")]
|
|
public class ServiceStackBenchmarks : BenchmarkBase
|
|
{
|
|
private IDbConnection _db;
|
|
|
|
[GlobalSetup]
|
|
public void Setup()
|
|
{
|
|
BaseSetup();
|
|
var dbFactory = new OrmLiteConnectionFactory(ConnectionString, SqlServerDialect.Provider);
|
|
_db = dbFactory.Open();
|
|
}
|
|
|
|
[Benchmark(Description = "SingleById<T>")]
|
|
public Post Query()
|
|
{
|
|
Step();
|
|
return _db.SingleById<Post>(i);
|
|
}
|
|
}
|
|
}
|