private static void HandleIncludeExcludeFields(PathEdgeNonGeneric targetEdge, IElementCreatorCore creator, IEnumerable <Expression> expressions, Boolean exclude) { var destinationType = targetEdge.EndNodeType; if (targetEdge.FieldsToExcludeInclude != null) { throw new Exception("There can only be one call to Exclude or Include in each part of the prefetch path."); } targetEdge.FieldsToExcludeInclude = new ExcludeIncludeFieldsList(exclude); var entity = LinqUtils.CreateEntityInstanceFromEntityType(destinationType, creator); var fields = expressions .Select(e => GetExpression <LambdaExpression>(e).Body) .Select(e => GetExpression <MemberExpression>(e).Member.Name) .Select(name => LinqUtils.GetFieldObject(entity, name)); targetEdge.FieldsToExcludeInclude.AddRange(fields); }