mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 06:27:15 +00:00
Migration from Amazon MWS to Selling Partner API
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user