private FileStorageContext GetReadContext() { var db = new FileStorageContext(); db.Configuration.AutoDetectChangesEnabled = false; return(db); }
/// <summary> /// Returns Stream with the file's data /// </summary> /// <returns></returns> public Stream GetContent() { using (var db = new FileStorageContext()) // FileStorageContext.GlobalConfig.ConnectionString: this needs to be redesigned { byte[] data = db.Files.Where(f => f.FileId.ToString() == Id).Select(f => f.Blob.Data).FirstOrDefault(); return(new MemoryStream(data)); } }
private FileStorageContext GetUpdateContext() { var db = new FileStorageContext(); return(db); }