0

When I filter according to the child property in my ShipmentOrder entity while filtering with dynamic expression, it takes the child property as an enum and I get this error. 'Enum type 'ShipmentAddress.CountryIdentifier' not found'. I wonder what kind of filtering should I do?

My dynamic expression is "(IsGift == "true" || new[] {"6763010d-d529-4169-88ac-97f44435e4a2", "3b189822-fe38-4a2e-a739-902c2d8a7f05", "3f748f66-0e68-4688-a078-79c5c9a2506b"}.Any(x => ShipmentAddress.CountryIdentifier.Contains(x))) && (BillingAddress.City == null || NofLines == "2")"

OuterValidationModel filter = JsonConvert.DeserializeObject<OuterValidationModel>(jsonBody);
string dynamicExpressionString = GenerateDynamicExpressionString(filter);
var result = deserializedSOList.AsQueryable().Where(dynamicExpressionString).ToList();

    ...
          else if (innerValidator.Comparator == "in")
                    {
                        var values = JsonConvert.DeserializeObject<List<string>>(innerValidator.Value);
                        var guidExpressions = values.Select(guid => $"\"{guid}\"");
                        var expression = $"new[] {{{string.Join(", ", guidExpressions)}}}";
                        innerCondition = $"{expression}.Any(x => {innerValidator.Field}.Contains(x))";
                    }
...

My model is enter image description here

sametcekin
  • 71
  • 1
  • 9

0 Answers0