You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
895 B
36 lines
895 B
|
|
using System.Data.SqlClient;
|
|
using DealerSelection.Common.Configuration;
|
|
|
|
namespace DealerSelection.Common.Data;
|
|
|
|
public static class ConnectionHelper
|
|
{
|
|
public static SqlConnection GetConnectionSync(string cxnName)
|
|
{
|
|
SqlConnection cxn = GetConnection(cxnName);
|
|
cxn.Open();
|
|
return cxn;
|
|
}
|
|
|
|
public static SqlConnection GetConnectionAsync(string cxnName)
|
|
{
|
|
SqlConnection cxn = GetConnection(cxnName);
|
|
cxn.OpenAsync();
|
|
return cxn;
|
|
}
|
|
|
|
private static SqlConnection GetConnection(string cxnName)
|
|
{
|
|
string cxnString = GetConnectionString(cxnName);
|
|
|
|
SqlConnection cxn = new SqlConnection(cxnString);
|
|
return cxn;
|
|
}
|
|
|
|
public static string GetConnectionString(string cxnName)
|
|
{
|
|
string cxnString = ConfigurationHelper.GetConnectionString(cxnName);
|
|
return cxnString;
|
|
}
|
|
}
|