mirror of
https://gitlab.com/Deukhoofd/DeukBot4.git
synced 2026-04-01 18:20:04 +00:00
Work on permission system, along with initial work on database(postgres) system
This commit is contained in:
28
DeukBot4/Database/DatabaseConnection.cs
Normal file
28
DeukBot4/Database/DatabaseConnection.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using DeukBot4.MessageHandlers.Permissions;
|
||||
using Npgsql;
|
||||
|
||||
namespace DeukBot4.Database
|
||||
{
|
||||
public class DatabaseConnection : IDisposable
|
||||
{
|
||||
public static string ConnectionString { private get; set; }
|
||||
private readonly NpgsqlConnection _connection;
|
||||
|
||||
public DatabaseConnection()
|
||||
{
|
||||
_connection = new NpgsqlConnection(ConnectionString);
|
||||
_connection.Open();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_connection.Dispose();
|
||||
}
|
||||
|
||||
public static implicit operator NpgsqlConnection(DatabaseConnection conn)
|
||||
{
|
||||
return conn._connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user