27 lines
721 B
C#
27 lines
721 B
C#
using SQLite;
|
|
using System.IO;
|
|
using Microsoft.Maui.Storage;
|
|
|
|
namespace HegreHotel
|
|
{
|
|
public class SingletonConnection : SQLiteAsyncConnection
|
|
{
|
|
// Instance unique de la connexion
|
|
private static SingletonConnection instance;
|
|
|
|
// Constructeur privé qui appelle le constructeur parent avec le chemin de la BDD
|
|
private SingletonConnection(string dbPath) : base(dbPath)
|
|
{
|
|
}
|
|
|
|
// Point d'accès global à l'instance
|
|
public static SingletonConnection GetInstance(string dbPath)
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = new SingletonConnection(dbPath);
|
|
}
|
|
return instance;
|
|
}
|
|
}
|
|
} |