linq对象的sqlfunctions.checksum [英] sqlfunctions.checksum of linq object

查看:47
本文介绍了linq对象的sqlfunctions.checksum的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何获得sql语句:

I'm trying to figure out how to get the sql statement:

select checksum_agg(checksum(*)) from Foo

在linq上班.只要知道列名,我就可以获取单个列的校验和:

to work from linq. I can get the checksum of a single column, so long as I know the column name:

SqlFunctions.ChecksumAggregate(Foo.Select(x => x.Id));

但是我希望能够对集合进行校验和,或者至少对列进行校验和而不知道名称.

But I would like to either be able to checksum the collection or at least checksum the columns individually without knowing the name(s).

推荐答案

查询例如,SqlFunctions.ChecksumAggregate(Foo.Select(x => x.Id));将为表Foo的每一行计算,对于所有非null列,在Id字段的计算校验和.

For example, SqlFunctions.ChecksumAggregate(Foo.Select(x => x.Id)); will calculate for each row of the table Foo, for all non-Null columns, calculate the checksum over the Id field.

因此,校验和将利用非null列的所有信息.

So the checksum will utilize all info of non-Null columns.

这篇关于linq对象的sqlfunctions.checksum的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆