Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using more complex objects #1

Open
jeffreypolk opened this issue Mar 5, 2021 · 0 comments
Open

using more complex objects #1

jeffreypolk opened this issue Mar 5, 2021 · 0 comments

Comments

@jeffreypolk
Copy link

Very interesting post and sample code! How might this be adapted to handle a more complex object with sub-objects and lists of objects? For example:

namespace ExpressionGenerator
{
    public class Transaction
    {
        public int Id { get; set; }
        public string Category { get; set; }
        public string TransactionType { get; set; }
        public string PaymentMode { get; set; }
        public decimal Amount { get; set; }
        public CostCenter CostCenter { get; set; }
        public List<Approver> Approvers { get; set; }
    }
    public class CostCenter
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Region { get; set; }
    }
    public class Approver
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

}

and perhaps a json like:

{
  "condition": "and",
  "rules": [
    {
      "label": "Cost Center Region",
      "field": "CostCenter.Region",
      "operator": "equal",
      "type": "string",
      "value": "US-EAST"
    },
    {
      "label": "Approver",
      "field": "Approvers.Name",
      "operator": "in",
      "type": "string",
      "value": [
        "Jeremy",
        "Jeff"
      ]
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant