获取不包含 Blob 本身的 Blob 大小
我有一个表,其中有一个代表文件的 blob 列。 我想运行一个 LinqToSql 查询,返回文件的名称和描述以及文件大小...但为了不影响性能,我显然不想下载整个 blob!
var q = from f in MyFiles
select new {f.Name, f.Description, f.Blob.Length};
似乎从数据库中提取整个 blob,然后计算其在本地内存中的长度。
我怎样才能做到这一点,以便我只获取 blob 大小,而不下载整个 blob?
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 file 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您的情况最好的选择是将文件存储到数据库时将 blob 大小存储在单独的列中。
I think the best choose in your case is to store blob size in the separate column, when storing file to database.