| | | 1 | | using Microsoft.Extensions.DependencyInjection; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Data.Dapper; |
| | | 4 | | |
| | | 5 | | /// <summary>DI registration for the Dapper query path.</summary> |
| | | 6 | | public 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<TContext></c>). |
| | | 12 | | /// </summary> |
| | | 13 | | /// <param name="services">The service collection.</param> |
| | | 14 | | public static IServiceCollection AddDapper(this IServiceCollection services) |
| | 1 | 15 | | { |
| | 1 | 16 | | services.AddScoped<ISqlQuery, DapperSqlQuery>(); |
| | 1 | 17 | | services.AddScoped<IAsyncSqlQuery, DapperSqlQuery>(); |
| | | 18 | | |
| | 1 | 19 | | return services; |
| | 1 | 20 | | } |
| | | 21 | | } |