本文介绍了与实体框架加密列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都想通了,通过实体框架4从数据库拉加密值的好办法?



我有一个MySQL数据库与DES_ENCRYPT加密一些列需能够得到这些值尽可能地简单,也是当然,更新和插入。



我认为这是很奇怪,似乎没有要在内置支持这在EF。即使是我们自己建的ORM系统有这种支持。我们只是添加评论加密为每个字段这就是加密和ORM工具将在查询中添加DES_DECRYPT(列)和DES_ENCRYPT(列)。



任何

解决方案

IMO应前>将其放入数据库,并将其保存为二进制数据。然后你就可以轻松获得字节[] 与EF



编辑:如果你使用什么样的存储过程完成所有的 DES_ENCRYPT DES_DECRYPT 以及选择/插入/删除为您服务。然后EF仍然会做的映射关系对吧?


Anyone figured out a good way to pull encrypted values from db through entity framework 4?

I got a MySql db with some columns encrypted with des_encrypt and need to be able to get those values as easy as possible, and also of course, update and insert them.

I think it's quite strange there doesn't seem to be in built support for this in EF. Even our own built ORM-system have support for this. We just add a comment "encrypted" for each field thats encrypted and the ORM tool will add des_decrypt(column) and des_encrypt(column) in the queries.

Anyone?

解决方案

IMO you should encrypt before putting it into the database and store it as binary data. Then you can easily get the byte[] with EF.

EDIT: What if you used a stored procedure to do all the des_encrypt and des_decrypt as well as the selects/inserts/deletes for you. Then EF will still do the mapping for you?

这篇关于与实体框架加密列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 03:09