Some refactorings

This commit is contained in:
2020-03-23 00:55:54 +01:00
parent bf67841d48
commit 70c6a28e54
5 changed files with 35 additions and 18 deletions

View File

@ -8,23 +8,27 @@ namespace TrackerLibrary
{
public static class GlobalConfig
{
public static List<IDataConnection> Connections { get; private set; } = new List<IDataConnection>();
public static void InitializeConnections(bool database, bool textFiles)
public static IDataConnection Connection { get; private set; }
public static void InitializeConnections(DatabaseType db)
{
if (database)
switch (db)
{
// TODO - Set up the sql connector properly !
SqlConnector sql = new SqlConnector();
Connections.Add(sql);
}
if (textFiles)
{
// TODO - Create the text Connection
TextConnector text = new TextConnector();
Connections.Add(text);
case DatabaseType.Sql:
// TODO - Set up the sql connector properly !
SqlConnector sql = new SqlConnector();
Connection = sql;
break;
case DatabaseType.TextFile:
// TODO - Create the text Connection
TextConnector text = new TextConnector();
Connection = text;
break;
default:
break;
}
}
public static string CnnString(string name)