'System.Data.SqlClient' wasn't found in the list of registered .NET core Data Providers.'
using Microsoft.Extensions.Configuration; using System.Configuration; using System.Data.Common; namespace Portal.DAL.DataAccess { public class GenericDbFactory { protected const string ProviderInvarientName = "System.Data.SqlClient"; public static DbProviderFactory Factory { get { return DbProviderFactories.GetFactory(ProviderInvarientName); } } public static DbConnection GetConnection(string dbName, IConfiguration configuration) { string ConnectionString = configuration.GetConnectionString("DefaultConnection"); DbConnection Connection = Factory.CreateConnection(); Connection.ConnectionString = ConnectionString; return Connection; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)