Files
Marc Gravell bd4f75b512 normalize async API surface over all TFMs (#2144)
* - normalize async API surface over all TFMs (fix #2143)
- target net8.0 instead of net5.0
- lib updates

* net9 SDK

* perf tests: clean up SqlClient warning

* CI fix: test concurrency

* rev snowflake
2025-02-06 12:11:30 +00:00

38 lines
1.1 KiB
C#

using BenchmarkDotNet.Attributes;
using System;
using System.Configuration;
using Microsoft.Data.SqlClient;
namespace Dapper.Tests.Performance
{
[BenchmarkCategory("ORM")]
public abstract class BenchmarkBase
{
protected static readonly Random _rand = new Random();
protected SqlConnection _connection;
public static ConnectionStringSettings ConnectionStringSettings { get; } = ConfigurationManager.ConnectionStrings["Main"];
public static string ConnectionString { get; } = ConnectionStringSettings.ConnectionString;
protected int i;
protected void BaseSetup()
{
i = 0;
_connection = new SqlConnection(ConnectionString);
_connection.Open();
}
protected void RegisterSqlFactory()
{
#if NETCOREAPP
System.Data.Common.DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
#endif
}
protected void Step()
{
i++;
if (i > 5000) i = 1;
}
}
}