我试图通过使用电子邮件过滤在combobox
中显示电子邮件。我的问题是我的数据在users表中被加密。LINQ to Entities无法识别方法'System.String Decrypt(System.String,System.String)'方法
当我试图解密它,它给这个错误:
LINQ to Entities does not recognize the method 'System.String Decrypt(System.String, System.String)' method, and this method cannot be translated into a store expression
我怎样才能解决这个问题?
这里是我的Lookup类
public class Lookup
{
public long boundvalue { get; set; }
public string boundtext { get; set; }
}
这里是我的代码过滤
public IEnumerable<Lookup> getUser(string fText)
{
var ret = new List<Lookup>
{
new Lookup
{
boundvalue = 0,
boundtext = ""
}
};
if (!string.IsNullOrEmpty(fText))
{
ret.AddRange(_entities.Users.Where(x =>EncDec.Decrypt(x.UserVar01.Trim().Replace("_",string.Empty),
Enums.EncDecSecKeyToString(Enums.EncDecSecKey.Email)).Contains(fText.Trim()))
.Select(select => new Lookup
{
boundvalue = select.UserID,
boundtext = EncDec.Decrypt(select.UserVar01.Trim().Replace("_", string.Empty),
Enums.EncDecSecKeyToString(Enums.EncDecSecKey.Email)),
}));
}
return ret;
}
未使用过'String.Encrypt'和'String.Decrypt'。但是在查询之前加密*'fText'而不是*解密*'x.UserVar01'呢? –