In continuation to this question: Database on data on the server
I deployed the base and wrote the program. I compared the speed of the program without inserting into the database and inserting the database and noticed that in the first case the program is completed faster than in the second case.
Insert carry out 1 entry. Is it possible to fill the database with a higher speed?
For example, this is how a class that adds files looks like:
public class FileProvider:BaseProvider { public static int Insert(int folder_id, FileInfo fileInfo) { using (var conn = new SqlConnection(ConnStr)) { conn.Open(); return conn.ExecuteScalar<int>(@"INSERT INTO dbo.[File](Folder_id,FileName,FileSizeMB) VALUES (@Folder_id,@FileName,@FileSizeMB) SELECT SCOPE_IDENTITY()", new { Folder_id = folder_id, FileName= fileInfo.Name, FileSizeMB = fileInfo.Length/1048576.0}); } } }
conn.Open()
execute in advance. bring upnew SqlConnection(ConnStr)
and this will significantly shorten the time - Senior Pomidor