列编程 [英] Column programming

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

问题描述



我在表格中有一个列,我想加密,我有很多代码可以访问这个列,所以我想使用相同的代码但是transperently(当读取 - descrypt时)并保存(加密)

任何帮助都非常有用

谢谢

Hi

I have a column in a table which I would like to encrypt, I have lots of code which access this column so I would like to use the same codem but transperently ( when reading - descrypt ) and save ( encrypt )

Any help would be really usefull

Thanks

推荐答案

如果列不用于选择/分组和其他服务器端操作一种方法是将列的访问权限更改为私有(可能将其重命名为SalaryEncrypted),然后在名为Salary的分部类中创建一个新属性,其中包含引用的get和set加密字段包含加密/解密方法,例如

public Decimal Salary {get {return MyEncryption.Decrypt(this.SalaryEncrypted); } set {this.SalaryEncrypted = MyEncryption.Encrypt(value); }



amien
If the column is not used for selections/group-by's and other server-side operations one way you could do this would be to change the column's access to private (perhaps renaming it e.g. SalaryEncrypted) and then create a new property in the partial class called Salary with a get and set that refers to the encrypted field wrapped up with the encryption/decryption methods, e.g.

public Decimal Salary { get { return MyEncryption.Decrypt(this.SalaryEncrypted); } set { this.SalaryEncrypted = MyEncryption.Encrypt(value); } }

[)amien


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

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