System.NotSupportedException:“The entity or complex type 'CSFramework.EF.tb_MyUser' cannot be constructed in a LINQ to Entities query.”
System.NotSupportedException:“The entity or complex type 'CSFramework.EF.tb_MyUser' cannot be constructed in a LINQ to Entities query.”
某个实体或复杂类型不能在 Linq to entity 中被创建。
解决方案
C# 全选
public List<tb_MyUser> User_Search(req_Permission_SearchCommon input)
{
var q = _dbSys.GetQueryable<tb_MyUser>();
if (!string.IsNullOrEmpty(input.Content))
q = q.Where(W => W.Account.Contains(input.Content) || W.UserName.Contains(input.Content));
//查询返回动态对象
var list= q.Select(s => new
{
//过滤2个图片字段的数据
Account = s.Account,
Address = s.Address,
CreateTime = s.CreateTime,
DataSets = s.DataSets,
DomainId = s.DomainId,
DomainName = s.DomainName,
Email = s.Email,
FlagAdmin = s.FlagAdmin,
FlagOnline = s.FlagOnline,
isid = s.isid,
}).ToList();
//再转换为具体类型
return ObjectHelper.Convert<List<tb_MyUser>>(list);
}
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网