Exemple #1
0
        private FileStorageContext GetReadContext()
        {
            var db = new FileStorageContext();

            db.Configuration.AutoDetectChangesEnabled = false;

            return(db);
        }
Exemple #2
0
        /// <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));
            }
        }
Exemple #3
0
        private FileStorageContext GetUpdateContext()
        {
            var db = new FileStorageContext();

            return(db);
        }