c# write big files to blob sqlite
I have c# application which writes files to an sqlite database.
It uses entity framework for modelling data.
It converts the file to a blob
(entity byte[]
variable) with this line:
row.file = System.IO.File.ReadAllBytes(file_to_load.FileName); //row.file is type byte[]
//row is entity class table
This works correctly when the file size is less than 300MB. When the file size is more than 300MB, the app throws an exception:
Exception of type 'System.OutOfMemoryException' was thrown.
How开发者_开发知识库 I can write to blob direct, without in-memory variables?
You'll have to use so-called Incremental BLOB I/O. See this post on a System.Data.SQLite forum.
精彩评论