I am trying to pass a List<string> to a method that will take it and use it to create a list of include statements to be used in an entity framework query.
For example:
List<string> myIncludes = new List<string>();
myIncludes.Add("myObject.FirstRelatedObject");
myIncludes.Add("myObject.SecondRelatedObject");
I want to use this list to get something like the following, dyamically:
var myQry = objectContext.object.Include(myIncludes[0]).Include(myIncludes[1]);
How would I go about doing this? I am using predicateBuilder to generate the "where" part of the statement, but I don't think that's the same thing as the "Include" portion.