Create Dynamic Expression one to many relations with child class property by dynamic-linq

21 views Asked by At

Is it possible to create a dynamic where condition with a collection property?

I'm trying to filter Parents which Childs.ChildProp1 == "test". What's the correct syntax ?

[Framework Url] https://github.com/zzzprojects/System.Linq.Dynamic.Core

public class Parent
{
    public string MasterProp1 { get; set; }
    public string MasterProp2 { get; set; }
    public IEnumerable<Child> Childs { get; set; }  
}


public class Child
{
    public string ChildProp1 { get; set; }
    public int ChildProp2 { get; set; }
}

Parents.Where("Childs.ChildProp1==\"test\"")
 
0

There are 0 answers