Squirrowse/squirrowse.db/DbContext.cs
2020-06-19 18:39:08 +02:00

32 lines
936 B
C#

using LiteDB;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models;
using squirrowse.core;
namespace squirrowse.db
{
public class DbContext
{
private readonly LiteDatabase _context;
public DbContext()
{
//BsonMapper.Global.Entity<Frame>().DbRef(x => x.Objects);
//BsonMapper.Global.Entity<DetectedObject>().DbRef(x => x.ObjectProperty);
_context = new LiteDatabase("db.db");
_context.GetCollection<Frame>();
_context.GetCollection<DetectResult>();
_context.GetCollection<DetectedObject>();
BsonMapper.Global.IncludeFields = true;
using (GetRepository)
{
GetRepository = _context;
}
}
public ILiteCollection<Frame> GetFrameCollection => _context.GetCollection<Frame>();
public LiteDatabase GetRepository { get; }
}
}