using Microsoft.Extensions.Configuration; using MySql.Data.MySqlClient; using System.Data.Common; using System.Data.SqlClient; namespace Traffic.Repository.Infrastructures { public class ConnectionFactory { private readonly IConfiguration _configuration; public ConnectionFactory(IConfiguration configuration) { _configuration = configuration; } public DbConnection CreateDbConn() { return new MySqlConnection(GetConnectionString()); } private string GetConnectionString() { //return _configuration.GetConnectionString("DefaultConnection"); return _configuration["ConnectionStrings:DefaultConnection"]; } } }