我正在使用以下查询,并且在table4中加密了companyname。我在web配置中启用了列加密设置。但是在执行以下查询时会抛出错误。
var companyname = (from user in testEntities.table1
where user.email == "test@gmail.com"
join mapper in testEntities.table2 on customerId equals mapper.CustomerId into details
from company in details.DefaultIfEmpty()
join type in testEntities.table3 on user.CustomerTypeId equals type.Id
join companycategory in testEntities.table4 on company.CompanyId equals companycategory.CompanyId into cateogryname
from companyname in cateogryname.DefaultIfEmpty()
select (companyname.CompanyName == null || company.IsActive == false) ? type.Type : companyname.CompanyName).FirstOrDefault();
错误
操作数类型冲突:varchar与使用加密的nvarchar(100)不兼容(encryption_type ='DETERMINISTIC',encryption_algorithm_name ='AEAD _....',column_encryption_key_name ='keyname',column_encryption_key_database_name ='testdb')\ r \ n语句(s)无法准备。