1
0
mirror of synced 2024-11-15 01:33:51 +00:00
PettingZoo/PettingZoo.Settings.LiteDB/BaseLiteDBRepository.cs

29 lines
652 B
C#
Raw Normal View History

using LiteDB;
using LiteDB.Async;
using PettingZoo.Core.Settings;
namespace PettingZoo.Settings.LiteDB
{
public class BaseLiteDBRepository
{
private readonly string databaseFilename;
protected static readonly BsonMapper Mapper = new()
{
EmptyStringToNull = false
};
public BaseLiteDBRepository(string databaseName)
{
databaseFilename = Path.Combine(PettingZooPaths.DatabasePath, $"{databaseName}.litedb");
}
protected ILiteDatabaseAsync GetDatabase()
{
return new LiteDatabaseAsync(databaseFilename, Mapper);
}
}
}