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

            db.Configuration.AutoDetectChangesEnabled = false;

            return(db);
        }
示例#2
0
文件: EFFile.cs 项目: xlgwr/osdr
        /// <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));
            }
        }
示例#3
0
        private FileStorageContext GetUpdateContext()
        {
            var db = new FileStorageContext();

            return(db);
        }