using Chatbot.Api.Domain.Data.DbContexts; using Chatbot.Api.Domain.Data.Repositories; using Chatbot.Api.Domain.Repositories; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.EntityFrameworkCore; namespace Chatbot.Api.Domain.Data { public static class DependencyInjectionExtensions { public static void AddDataAccess(this IServiceCollection services) { services.AddScoped(); services .AddDbContextPool( (serviceProvider, options) => { var configuration = serviceProvider.GetService(); var connectionString = configuration.GetConnectionString("DatabaseConnection"); options.UseSqlServer(connectionString); }); } } }