1

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?

1 Answer 1

1

You'll have to use so-called Incremental BLOB I/O. See this post on a System.Data.SQLite forum.

Sign up to request clarification or add additional context in comments.

2 Comments

For the curious, this (now expired) link went to here but it seems the proposed patch never made it and Incremental Blob IO is still not possible with System.Data.SQLite 1.0.95
It should be in 1.0.103.0 according to this timeline

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.