0

I have the following classes:

public class Configuration
{
    public long Id {get;set;}
    public string Name {get;set;}
    public Expression Criteria {get;set;}
}

public class Expression
{
    public long Id {get;set;}
    public string Value {get;set;}
    public ICollection<Parameter> Parameters {get;set;}
}

public class Parameter
{
    public long Id {get;set;}
    public MyType Type {get;set;}
}

public class MyType
{
    public long Id {get;set;}
    public string Name {get;set;}
}

I am trying to eagerly load the entire configuration object using:

dbContext.Configurations.Select(i => i.Criteria).Include(i => i.Parameters.Select(j => j.Type)).ToList()

I am however getting null for the Parameters property and it is not getting fetched.

What am I doing wrong.

SharePoint Newbie
  • 5,974
  • 12
  • 62
  • 103

1 Answers1

0

Try this:

dbContext.Configurations.Select(i => i.Criteria).Include("Parameters").Include("Parameters.Type").ToList()
greg84
  • 7,541
  • 3
  • 36
  • 45