Getting a blob size without the blob itself
I have a table that has a blob column representing a file. I'd like to run a LinqToSql query that returns a name and description of the file, along with the fi开发者_如何学编程le size... but in the interests of not killing performance, I obviously don't want to download the whole blob!
var q = from f in MyFiles
select new {f.Name, f.Description, f.Blob.Length};
appears to pull the entire blob from the DB, then calculate its length in local memory.
How can I do this so that I only get the blob size, without downloading the entire blob?
I think the best choose in your case is to store blob size in the separate column, when storing file to database.
精彩评论