解释存储过程中的 byte[]
我们通过加密搜索字段并比较这些加密值来搜索加密字段。我需要做的是将加密值(因为代码对其进行加密)传递到过程(通过实体框架 4),但如果未提供该值,也允许 null。
所以我需要传递一个 byte[] 但它也需要接受空值...这是否可能,或者如果不可能的话有什么解决方法?再次,我通过实体框架调用存储过程。
谢谢。
A proc we have searches an encrypted field by encrypting the search field and comparing these encrypted values. What I need though to be able to do is to pass into the proc (through Entity Framework 4) the encrypted value (as the code encrypts it), but also allow null if the value is not provided.
So I need to pass in a byte[] but it also needs to accept nulls... is this even possible, or what is a workaround if its not? Again, I'm calling a stored procedure through entity framework.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们最终通过将其作为字符串推送,然后在过程中解析它来使其工作。那行得通。但我相信我读到有一个表示 byte[] 数组的 Binary 对象,这也可以工作。
We ended up getting it to work by pushing it as a string, and then parsing it in the proc. That worked. But I believe I read there is a Binary object that represents the byte[] array, and that would have worked too.
给定这个存储过程:
以下代码将执行它,如果传递的参数为 null,则传递 NULL:
该测试工具
会产生预期的结果:
Given this stored procedure:
The following code will execute it, passing NULL if the parameter passed is null:
This test harness
produces the expected results: