41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
using Dapper;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Gsm
|
|
{
|
|
public class GsmRO : GsmDB
|
|
{
|
|
public static class Tables
|
|
{
|
|
public static string Directories { get { return "Directories"; } }
|
|
public static string GameEntry { get { return "GameEntry"; } }
|
|
public static string RegistryList { get { return "RegistryList"; } }
|
|
}
|
|
|
|
public static class Columns
|
|
{
|
|
public static string ID { get { return "id"; } }
|
|
public static string GameID { get { return "GameID"; } }
|
|
public static string GameName { get { return "GameName"; } }
|
|
}
|
|
|
|
public List<T> LoadRecords<T>(string select, string from, string column, string query, bool exactMatch)
|
|
{
|
|
string command = $"SELECT \"{select}\",*" +
|
|
$"FROM \"main\".\"{from}\"" +
|
|
$"WHERE \"{column}\"";
|
|
|
|
if (exactMatch == true)
|
|
{
|
|
command += $"LIKE \"{query}\"";
|
|
}
|
|
else
|
|
{
|
|
command += $"LIKE \"%{query}%\"";
|
|
}
|
|
|
|
return (List<T>) DBConnection.Query<T>(command, new DynamicParameters());
|
|
}
|
|
}
|
|
}
|