Migration from Amazon MWS to Selling Partner API

This commit is contained in:
Bobbie Hodgetts
2024-04-11 12:26:13 +01:00
committed by GitHub
parent e054278cdd
commit a7bc00e73a
1318 changed files with 2778105 additions and 5936 deletions

View File

@@ -4,21 +4,45 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Configuration;
namespace bnhtrade.Core.Data.Database
{
public class Connection
{
protected readonly string sqlConnectionString;
//protected readonly string SqlConnectionString;
private Model.Credentials.bnhtradeDB dbCredentials;
public Connection(string sqlConnectionString)
protected string SqlConnectionString
{
get { return dbCredentials.ConnectionString; }
}
public Connection()
{
// attempt to retrive credentials from app.local.config
try
{
var dbCredentials = new bnhtrade.Core.Model.Credentials.bnhtradeDB(
ConfigurationManager.AppSettings["DbDataSource"]
, ConfigurationManager.AppSettings["DbUserId"]
, ConfigurationManager.AppSettings["DbUserPassword"]
);
this.dbCredentials = dbCredentials;
}
catch(Exception ex)
{
throw new Exception("Unable to retirve DB credentials: " + ex.Message);
}
}
public Connection(Model.Credentials.bnhtradeDB dbCredentials)
{
// setup sql parameters
if (string.IsNullOrWhiteSpace(sqlConnectionString))
{
throw new Exception("Zero length sql connection string passed");
if (dbCredentials == null)
{
throw new Exception("DB credentials object is null");
}
this.sqlConnectionString = sqlConnectionString;
}
}
}