mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-18 14:27:47 +08:00
77cd19d0e9
Hi! This PR tries to fix Dapper.Performance.Tests, actually you can't get [MemoryDiagnoser](https://benchmarkdotnet.org/api/BenchmarkDotNet.Diagnosers.MemoryDiagnoser.html) stats because ```IDiagnoser.GetColumnProvider()``` method was gone on BenchmarkDotnet 0.11.2. I choose ```DefaultColumnProviders.Metrics``` because of [this](https://github.com/dotnet/BenchmarkDotNet/issues/1184#issuecomment-507377695), i think it's the most simple way to add stats now. **Before**  **After**  On the other hand i choose removing ```[Ordered]``` as temporal solution of https://github.com/dotnet/BenchmarkDotNet/issues/1238, and yeah, the results are still ordered because of https://github.com/StackExchange/Dapper/blob/9282ef2872e1c82c68c86f31e93e8f1ceaacd409/Dapper.Tests.Performance/Config.cs#L42 **Before**  **After** (No errors) Thanks for all!!
31 lines
816 B
C#
31 lines
816 B
C#
using BenchmarkDotNet.Attributes;
|
|
using BenchmarkDotNet.Order;
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace Dapper.Tests.Performance
|
|
{
|
|
[BenchmarkCategory("ORM")]
|
|
public abstract class BenchmarkBase
|
|
{
|
|
protected static readonly Random _rand = new Random();
|
|
protected SqlConnection _connection;
|
|
public static string ConnectionString { get; } = ConfigurationManager.ConnectionStrings["Main"].ConnectionString;
|
|
protected int i;
|
|
|
|
protected void BaseSetup()
|
|
{
|
|
i = 0;
|
|
_connection = new SqlConnection(ConnectionString);
|
|
_connection.Open();
|
|
}
|
|
|
|
protected void Step()
|
|
{
|
|
i++;
|
|
if (i > 5000) i = 1;
|
|
}
|
|
}
|
|
}
|