public static IncludePaths Create <TEntity>(params Expression <Func <TEntity, object> >[] paths) { var include = new IncludePaths(); foreach (var item in paths) { include.Paths.Add(IncludePath.Create <TEntity>(item)); } return(include); }
public static IncludePath Create <TEntity>(System.Linq.Expressions.Expression <Func <TEntity, object> > path) { var include = new IncludePath(); var body = path.Body; string pathString = null; if (!TryGetPath(body, out pathString)) { throw new ArgumentException("The given path expression is not valid", "path"); } include.Path = pathString; include.EntityType = typeof(TEntity); return(include); }