mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-17 18:39:07 +00:00
23 lines
482 B
C#
23 lines
482 B
C#
using Microsoft.Extensions.Logging;
|
|
using MySqlConnector;
|
|
|
|
namespace WeaponPaints
|
|
{
|
|
public class Database(string dbConnectionString)
|
|
{
|
|
public async Task<MySqlConnection> GetConnectionAsync()
|
|
{
|
|
try
|
|
{
|
|
var connection = new MySqlConnection(dbConnectionString);
|
|
await connection.OpenAsync();
|
|
return connection;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
WeaponPaints.Instance.Logger.LogError($"Unable to connect to database: {ex.Message}");
|
|
throw;
|
|
}
|
|
}
|
|
}
|
|
} |