using VentaUniformes.Persistencia.Services;
using VentaUniformes.Application.Interfaces;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.Data.SqlClient;
namespace VentaUniformes.Persistencia
{
    public static class DependencyInjectionService
    {
        public static IServiceCollection AddPersistencia(this IServiceCollection services, IConfiguration config)
        {
            services.AddDbContext<PersistenciaService>( options =>
            options.UseSqlServer(config["SqlConnectionString"]));

            services.AddScoped<IPersistenciaService, PersistenciaService>();


            //para cifrado de bbdd
            /*
             * Falta investigar como hacer un probaider de certificados
             * * /

            SqlConnection.RegisterColumnEncryptionKeyStoreProviders(new Dictionary<string,
                SqlColumnEncryptionCertificateStoreProvider>(1)//, StringComparer.OrdinalIgnoreCase)
            {
                { SqlColumnEncryptionCertificateStoreProvider.ProviderName,provaider_certificados }
            });

            */
            return services;
        }
    }
}
