开发者

Getting a blob size without the blob itself

开发者 https://www.devze.com 2022-12-19 17:42 出处:网络
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 i

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号