public override FilterNode <ClrValue> Visit(CompareFilter <ClrValue> nodeIn, Args args) { var result = nodeIn; var(path, op, value) = nodeIn; var clrValue = value.Value; if (string.Equals(path[0], "id", StringComparison.OrdinalIgnoreCase)) { path = "_id"; if (clrValue is List <string> idList) { value = idList.Select(x => DomainId.Combine(args.AppId, DomainId.Create(x)).ToString()).ToList(); } else if (clrValue is string id) { value = DomainId.Combine(args.AppId, DomainId.Create(id)).ToString(); } else if (clrValue is List <Guid> guidIdList) { value = guidIdList.Select(x => DomainId.Combine(args.AppId, DomainId.Create(x)).ToString()).ToList(); } else if (clrValue is Guid guidId) { value = DomainId.Combine(args.AppId, DomainId.Create(guidId)).ToString(); } } else { path = Adapt.MapPath(path); if (clrValue is List <Guid> guidList) { value = guidList.Select(x => x.ToString()).ToList(); } else if (clrValue is Guid guid) { value = guid.ToString(); } else if (clrValue is Instant && !string.Equals(path[0], "mt", StringComparison.OrdinalIgnoreCase) && !string.Equals(path[0], "ct", StringComparison.OrdinalIgnoreCase)) { value = clrValue.ToString(); } } return(result with { Path = path, Value = value }); }
public override FilterNode <ClrValue> Visit(CompareFilter <ClrValue> nodeIn, None args) { if (string.Equals(nodeIn.Path[0], "id", StringComparison.OrdinalIgnoreCase)) { return(nodeIn); } var path = Adapt.MapPath(nodeIn.Path); return(nodeIn with { Path = path }); }