Getting the size of the drop without the drop itself

I have a table in which there is a blob column representing a file. I would like to run a LinqToSql query that returns the file name and description along with the file size ... but in the interest of not killing performance, I obviously do not want to download the entire blob!

var q = from f in MyFiles select new {f.Name, f.Description, f.Blob.Length}; 

appears to pull out the entire block from the database, and then calculate its length in local memory.

How can I do this to get the blob size without loading the whole frame?

+4
source share
1 answer

I think that the best choice in your case is to save the blob size in a separate column when storing the file in the database.

+7
source

Source: https://habr.com/ru/post/1300591/


All Articles