Some refactorings
This commit is contained in:
14
TrackerLibrary/Enums.cs
Normal file
14
TrackerLibrary/Enums.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TrackerLibrary
|
||||
{
|
||||
public enum DatabaseType
|
||||
{
|
||||
Sql,
|
||||
TextFile
|
||||
}
|
||||
}
|
||||
@ -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)
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
<Compile Include="DataAccess\IDataConnection.cs" />
|
||||
<Compile Include="DataAccess\SqlConnector.cs" />
|
||||
<Compile Include="DataAccess\TextConnector.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
<Compile Include="GlobalConfig.cs" />
|
||||
<Compile Include="Models\MatchupEntryModel.cs" />
|
||||
<Compile Include="Models\MatchupModel.cs" />
|
||||
|
||||
Reference in New Issue
Block a user