LiteDbContext.cs 310 B

123456789101112131415
  1. using LiteDB;
  2. using Microsoft.Extensions.Options;
  3. namespace api.Database
  4. {
  5. public class LiteDbContext {
  6. public readonly LiteDatabase Context;
  7. public LiteDbContext(IOptions<LiteDbConfig> config) {
  8. var db = new LiteDatabase(config.Value.DatabasePath);
  9. if(db != null) {
  10. Context = db;
  11. }
  12. }
  13. }
  14. }