38 lines
972 B
C#
38 lines
972 B
C#
using LiteDB;
|
|
|
|
using skydiveLogs_api.Data.Interface;
|
|
using skydiveLogs_api.Model;
|
|
|
|
namespace skydiveLogs_api.Data
|
|
{
|
|
public class LiteDbProvider : IDataProvider
|
|
{
|
|
public LiteDbProvider(string connectionString)
|
|
{
|
|
_db = new LiteDatabase(connectionString);
|
|
}
|
|
|
|
public LiteCollection<T> GetCollection<T>()
|
|
{
|
|
return _db.GetCollection<T>();
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
_db.Dispose();
|
|
}
|
|
|
|
private readonly LiteDatabase _db;
|
|
|
|
public LiteCollection<Aircraft> CollOfAircraft => _db.GetCollection<Aircraft>();
|
|
|
|
public LiteCollection<DropZone> CollOfDropZone => _db.GetCollection<DropZone>();
|
|
|
|
public LiteCollection<Gear> CollOfGear => _db.GetCollection<Gear>();
|
|
|
|
public LiteCollection<JumpType> CollOfJumpType => _db.GetCollection<JumpType>();
|
|
|
|
public LiteCollection<Jump> CollOfJump => _db.GetCollection<Jump>();
|
|
}
|
|
}
|