test
test
This commit is contained in:
parent
6a182fff9d
commit
bda704e843
21 changed files with 3012 additions and 2663 deletions
31
Database.cs
31
Database.cs
|
|
@ -1,31 +0,0 @@
|
|||
using Microsoft.Extensions.Logging;
|
||||
using MySqlConnector;
|
||||
|
||||
namespace CS2_SimpleAdmin
|
||||
{
|
||||
public class Database
|
||||
{
|
||||
private readonly string _dbConnectionString;
|
||||
|
||||
public Database(string dbConnectionString)
|
||||
{
|
||||
_dbConnectionString = dbConnectionString;
|
||||
}
|
||||
|
||||
public async Task<MySqlConnection> GetConnectionAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var connection = new MySqlConnection(_dbConnectionString);
|
||||
await connection.OpenAsync();
|
||||
return connection;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (CS2_SimpleAdmin._logger != null)
|
||||
CS2_SimpleAdmin._logger.LogCritical("Unable to connect to database");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue