public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); return fs.Delete(id); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); return(fs.Delete(id)); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); var metadata = JsonSerializer.Deserialize(s).AsDocument; return(fs.SetMetadata(id, metadata)); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); var metadata = JsonSerializer.Deserialize(s).AsDocument; return fs.SetMetadata(id, metadata); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); var filename = Path.GetFullPath(s.Scan(@"\s*.*").Trim()); if (!File.Exists(filename)) throw new IOException("File " + filename + " not found"); var file = fs.Upload(id, filename); return file.AsDocument; }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); var filename = Path.GetFullPath(s.Scan(@"\s*.*").Trim()); if (!File.Exists(filename)) { throw new IOException("File " + filename + " not found"); } var file = fs.Upload(id, filename); return(file.AsDocument); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = ReadId(s); var filename = s.Scan(@"\s*.*").Trim(); var file = fs.FindById(id); if (file != null) { file.SaveAs(filename, true); return(file.AsDocument); } return(false); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); var fileHandler = LitePlatform.Platform.FileHandler; var filename = s.Scan(@"\s*.*").Trim(); if (!fileHandler.FileExists(filename)) { throw new IOException("File " + filename + " not found"); } var file = fs.Upload(id, filename); return(file.AsDocument); }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); if (s.HasTerminated) { var files = fs.FindAll().Select(x => x.AsDocument); return(new BsonArray(files)); } else { var id = this.ReadId(s); var files = fs.Find(id).Select(x => x.AsDocument); return(new BsonArray(files)); } }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); if (s.HasTerminated) { var files = fs.FindAll().Select(x => x.AsDocument); return new BsonArray(files); } else { var id = this.ReadId(s); var files = fs.Find(id).Select(x => x.AsDocument); return new BsonArray(files); } }
public BsonValue Execute(DbEngine engine, StringScanner s) { var fs = new LiteFileStorage(engine); var id = this.ReadId(s); var filename = s.Scan(@"\s*.*").Trim(); var file = fs.FindById(id); if (file != null) { file.SaveAs(filename, true); return file.AsDocument; } else { return false; } }
/// <summary> /// Creates a new instance of <see cref="LiteDBStorageRepository"/> attached to the given context /// </summary> /// <remarks>Limit per file is 2 GB</remarks> public LiteDBStorageRepository(ILiteDBContext dbContext) { Contract.Requires(dbContext != null); _fileStorage = dbContext.Database.FileStorage; }