1
0
mirror of synced 2024-11-15 01:33:51 +00:00
PettingZoo/PettingZoo.Settings.LiteDB/BaseLiteDBRepository.cs
Mark van Renswoude 133adf205c WIP: generate examples from Tapeti message classes from NuGet feeds
- Implementation of assembly/nuget package selection UI
- Actual example generation needs more work
2021-12-31 18:48:04 +01:00

29 lines
651 B
C#

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.AppDataRoot, $"{databaseName}.litedb");
}
protected ILiteDatabaseAsync GetDatabase()
{
return new LiteDatabaseAsync(databaseFilename, Mapper);
}
}
}