private static void UpdateFile(S3FileInfo file, AWSS3Object dbFile) { dbFile.FileModified = GetLastModifiedFromS3(file.FullName); dbFile.FileSize = file.Length; dbFile.LastScanned = scanTime; updated++; }
private static void ScanFile(S3FileInfo file) { if (scanned >= 5000) { SubmitBatch(); } DateTime fileModified = new SqlDateTime(GetLastModifiedFromS3(file.FullName)).Value; // if file is already in database try { AWSS3Object dbFile = db.AWSS3Objects.Single(f => f.FileKey == file.FullName); // if file was modified, update database record if (!fileModified.Equals(dbFile.FileModified)) { UpdateFile(file, dbFile); } else { dbFile.LastScanned = scanTime; } } catch (Exception e) { InsertFile(file); } scanned++; }
private static void InsertFile(S3FileInfo file) { AWSS3Object dbFile = new AWSS3Object() { FileKey = file.FullName, FileName = file.Name, FileModified = GetLastModifiedFromS3(file.FullName), FileSize = file.Length, WindowsFilePath = GetLocalNameFromS3(file.FullName), LastScanned = scanTime }; insertionList.Add(dbFile); inserted++; }
partial void DeleteAWSS3Object(AWSS3Object instance);
partial void UpdateAWSS3Object(AWSS3Object instance);
partial void InsertAWSS3Object(AWSS3Object instance);