< Summary

Information
Class: ArturRios.Data.Dapper.ServiceCollectionExtensions
Assembly: ArturRios.Data.Dapper
File(s): /home/runner/work/dotnet-data/dotnet-data/src/ArturRios.Data.Dapper/ServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 23
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 1
Fully covered methods: 1
Total methods: 1
Method coverage: 100%
Full method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddDapper(...)100%11100%

File(s)

/home/runner/work/dotnet-data/dotnet-data/src/ArturRios.Data.Dapper/ServiceCollectionExtensions.cs

#LineLine coverage
 1using Microsoft.Extensions.DependencyInjection;
 2
 3namespace ArturRios.Data.Dapper;
 4
 5/// <summary>DI registration for the Dapper query path.</summary>
 6public static class ServiceCollectionExtensions
 7{
 8    /// <summary>
 9    ///     Registers <see cref="ISqlQuery" /> and <see cref="IAsyncSqlQuery" /> (scoped, backed by
 10    ///     <see cref="DapperSqlQuery" />). Requires a <c>BaseDbContext</c> to be registered
 11    ///     (e.g. via <c>AddDataConfigFromSettings&lt;TContext&gt;</c>).
 12    ///     Query failures are logged in full when logging is registered (<c>AddLogging</c>);
 13    ///     without it the executor still runs and error envelopes carry no provider text.
 14    /// </summary>
 15    /// <param name="services">The service collection.</param>
 16    public static IServiceCollection AddDapper(this IServiceCollection services)
 17    {
 418        services.AddScoped<ISqlQuery, DapperSqlQuery>();
 419        services.AddScoped<IAsyncSqlQuery, DapperSqlQuery>();
 20
 421        return services;
 22    }
 23}