mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-23 00:58:32 +08:00
aecffecae1
* attempt NRT makeover - annotate NRTs on GridReader API - add protected access to some of the GridReader internals - switch GridReader callbacks to be more type-independent docs lib updates; deal with yellow warnings and test failures (SQL server certs and cancellation surfacing differently) fix break simplify proposed GridReader changes to protected OnBeforeGrid and OnAfterGrid[Async] Builds: Bump library versions (#1935) Tests: Upgrade dependencies for Dependabot (#1936) I'll do a pass at all of these later, but getting CVE versions out of the pipe. Resolving 4 alerts here: https://github.com/DapperLib/Dapper/security/dependabot merge and lib updates allow Identity to be constructed on-the-fly inside GridReader fix build warnings include readme rev minor - enable [SkipLocalsInit] everywhere - use NET5_0_OR_GREATER for remoting check # Conflicts: # Dapper/CommandDefinition.cs # Dapper/DefaultTypeMap.cs # Dapper/SqlMapper.Async.cs # Dapper/SqlMapper.IDataReader.cs # Dapper/SqlMapper.Link.cs # Dapper/SqlMapper.cs # Directory.Build.props * shipped, not unshipped * fixup SqlBuilder; use is null / is not null * use central package management (#1949) * Nullable test tweaks * Nuget: let's just remove it! * 2 test fixes from review * fix FindExplicitConstructor * add GetPropertySetterOrThrow * fix NRT on FindConstructor * DapperRow: value is object? * use NotNullWhen * make constructor problem more obvious * test fixes --------- Co-authored-by: Nick Craver <nrcraver@gmail.com>
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System.ComponentModel;
|
|
using System.Linq;
|
|
using BenchmarkDotNet.Attributes;
|
|
using RepoDb;
|
|
|
|
namespace Dapper.Tests.Performance
|
|
{
|
|
[Description("RepoDB")]
|
|
public class RepoDbBenchmarks : BenchmarkBase
|
|
{
|
|
[GlobalSetup]
|
|
public void Setup()
|
|
{
|
|
BaseSetup();
|
|
GlobalConfiguration.Setup().UseSqlServer();
|
|
ClassMapper.Add<Post>("Posts");
|
|
}
|
|
|
|
[Benchmark(Description = "Query<T>")]
|
|
public Post Query()
|
|
{
|
|
Step();
|
|
return _connection.Query<Post>(i).First();
|
|
}
|
|
|
|
[Benchmark(Description = "QueryWhere<T>")]
|
|
public Post QueryWhere()
|
|
{
|
|
Step();
|
|
return _connection.Query<Post>(x => x.Id == i).First();
|
|
}
|
|
|
|
[Benchmark(Description = "QueryDynamic<T>")]
|
|
public Post QueryDynamic()
|
|
{
|
|
Step();
|
|
return _connection.Query<Post>(new { Id = i }).First();
|
|
}
|
|
|
|
[Benchmark(Description = "QueryField<T>")]
|
|
public Post QueryField()
|
|
{
|
|
Step();
|
|
return _connection.Query<Post>(new QueryField[] { new(nameof(Post.Id), i) }).First();
|
|
}
|
|
|
|
[Benchmark(Description = "ExecuteQuery<T>")]
|
|
public Post ExecuteQuery()
|
|
{
|
|
Step();
|
|
return _connection.ExecuteQuery<Post>("select * from Posts where Id = @Id", new { Id = i }).First();
|
|
}
|
|
}
|
|
}
|