You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel.EventsServer/EventRepository.cs

25 lines
768 B

2 years ago
using System.Threading;
5 years ago
namespace ZeroLevel.EventServer
{
public class EventRepository
:BaseSqLiteDB
{
private readonly SQLiteConnection _db;
private readonly ReaderWriterLockSlim _rwLock = new ReaderWriterLockSlim();
private readonly string _tableName;
public EventRepository()
{
_tableName = "events";
var path = PrepareDb($"{_tableName}.db");
_db = new SQLiteConnection($"Data Source={path};Version=3;");
_db.Open();
Execute($"CREATE TABLE IF NOT EXISTS {_tableName} (id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, body BLOB)", _db);
Execute($"CREATE INDEX IF NOT EXISTS key_index ON {_tableName} (key)", _db);
}
}
}

Powered by TurnKey Linux.