[英]Servicestack : Specified method not supported
I am getting a method not specified error after adding Any in the query.在查询中添加Any后,出现方法未指定错误。 Please find the below snippet
请找到下面的片段
Models楷模
public class BodyTatoo
{
public BodyTatoo()
{
}
public Guid Id { get; set; }
[Reference]
public List<BodyTattooColor> TattooColors {get;set;} = new List<BodyTattooColor>();
}
public class BodyTattooColor
{
public Guid Id { get; set; }
[References(typeof(Color))]
public int ColorId{ get; set; }
[Reference]
public Color Color { get; set; }
[References(typeof(BodyTatoo)]
public Guid BodyTattooId { get; set; }
[Reference]
public BodyTatoo BodyTatoo { get; set; }
}
public class Color
{
public int Id { get; set; }
public string Name { get; set; }
}
-------------------------------------------------
Request DTO请求 DTO
public class RequestDto : IReturn<Result>
{
// It can be comma separated value eg: "Black, Green, Red etc.."
public string Colors { get; set; }
public Guid Id { get; set; }
}
public List<Result> Get(RequestDto request)
{
var query = Db.From<>()
.leftJoin<BodyTatoo,BodyTattooColor>()
.leftJoin<BodyTattooColor,Color>();
var colorArray = request.colors.split(",");
query = query.Or<BodyTatoo>(x => x.BodyTattooColor
.Any(v => colorArray.Any(c => v.Color.Name.Contains(c))));
}
Let me know if there is any way to resolve that.让我知道是否有任何方法可以解决这个问题。
query = query.Or(x => x.BodyTattooColor .Any(v => colorArray.Any(c => v.Color.Name.Contains(c)))); query = query.Or(x => x.BodyTattooColor .Any(v => colorArray.Any(c => v.Color.Name.Contains(c)))); this line is giving the issue.
这条线给出了问题。
好的,所以我可以使用下面的代码来解决这个问题。
query = query.Or<BodyTattooColor>(x => colorArray.Any(c => x.Color.Name.Contains(c))));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.