我使用包含SHA512哈希的EF插入数据.然后我查找相同的数据,但没有返回结果:
var searchHash = requestToFind.GetSelfSha512Hash(); var foundRequest = _complianceContext.ScoreResults .Where(sr => sr.SearchHash == searchHash);
sr.SearchHash和searchHash都是byte [].
如果我取出Where子句,我会得到1个结果.任何想法为什么会这样?
等于运算符不像您期望的字节数组那样工作.尝试SequenceEqual.
var foundRequest = _complianceContext.ScoreResults .Where(sr => sr.SequenceEqual(searchHash));