diff --git a/Dapper.Tests.Performance/Benchmarks.Mighty.cs b/Dapper.Tests.Performance/Benchmarks.Mighty.cs new file mode 100644 index 00000000..4a1b69fd --- /dev/null +++ b/Dapper.Tests.Performance/Benchmarks.Mighty.cs @@ -0,0 +1,50 @@ +using BenchmarkDotNet.Attributes; +using Mighty; +using System.ComponentModel; +using System.Linq; + +namespace Dapper.Tests.Performance +{ + [Description("Mighty")] + public class MightyBenchmarks : BenchmarkBase + { + private MightyOrm _model; + private MightyOrm _dynamicModel; + + [GlobalSetup] + public void Setup() + { + BaseSetup(); + _model = new MightyOrm(ConnectionString); + _dynamicModel = new MightyOrm(ConnectionString); + } + + [Benchmark(Description = "Query")] + public Post Query() + { + Step(); + return _model.Query("select * from Posts where Id = @0", _connection, i).First(); + } + + [Benchmark(Description = "Query")] + public dynamic QueryDynamic() + { + Step(); + return _dynamicModel.Query("select * from Posts where Id = @0", _connection, i).First(); + } + + [Benchmark(Description = "SingleFromQuery")] + public Post SingleFromQuery() + { + Step(); + return _model.SingleFromQuery("select * from Posts where Id = @0", _connection, i); + } + + [Benchmark(Description = "SingleFromQuery")] + public dynamic SingleFromQueryDynamic() + { + Step(); + return _dynamicModel.SingleFromQuery("select * from Posts where Id = @0", _connection, i); + } + } +} diff --git a/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj b/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj index 5d897654..7078f87b 100644 --- a/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj +++ b/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj @@ -21,6 +21,7 @@ +