Review on core EF repository method What do you think about this core EF method ?

Also, Notice that it returns IQueryable: 

Could that be a performance danger when extended improperly ? How ?

Please accept the fact that Includes and OrderBy parameters are string type.

public IQueryable&lt;TEntity&gt; GetEntitySetMultipleTables(Expression&lt;Func&lt;TEntity, bool&gt;&gt; WhereExpression = null,
                                                string OrderBy = null,
                                                int TotalResults = int.MaxValue, int SkippedResults = 0, string[] Includes = null)
    {
        if (OrderBy != null)
        {
            string orderbyProperty = OrderBy;
            if (OrderBy.IndexOf(' ') &gt; -1) // Direction
            {
                orderbyProperty = OrderBy.Substring(0, OrderBy.IndexOf(' '));
            }

            if (typeof(TEntity).GetProperty(orderbyProperty) == null)
                OrderBy = null;
        }
        if ((SkippedResults &gt; 0) &amp;&amp; (OrderBy == null))
        {
            OrderBy = GetPrimaryKeyName();
        }

        //Base EntitySet
        IQueryable&lt;TEntity&gt; results;
        ObjectQuery&lt;TEntity&gt; objectSetResults = Context.CreateObjectSet&lt;TEntity&gt;();
        if (Includes == null)
            results = objectSetResults.AsQueryable();
        else
        {
            foreach (var include in Includes)
            {
                objectSetResults = objectSetResults.Include(include.Trim());
            }
            results = objectSetResults.AsQueryable();
        }

        //Filter by Where Expression
        if (WhereExpression != null)
            results = results.Where(WhereExpression);

        //Order Results
        if (OrderBy != null)
        {
            results = results.OrderBy(OrderBy);
        }

        //Skip Records
        if (SkippedResults &gt; 0)
            results = results.Skip(SkippedResults);

        //Take Specific Amount of records
        if (TotalResults != int.MaxValue)
            results = results.Take(TotalResults);

        //Run the LINQ Query and return the results
        return results;
    }


Thanks in advance.
I'm not sure how this code works (I had to invent GetPrimaryKeyName) and I can't find a IQueryable&lt;T&gt; that has an OrderBy that takes a string parameter.  So faking it as much as possible, I came up with this:

    public IQueryable&lt;TEntity&gt; GetEntitySetMultipleTables(
        Expression&lt;Func&lt;TEntity, bool&gt;&gt; whereExpression = null,
        string orderBy = null,
        int? totalResults = null,
        int? skippedResults = null,
        string[] includes = null)
    {
        PropertyInfo orderbyProperty;
        int directionIndex;

        if (orderBy == null)
        {
            directionIndex = -1;
            orderbyProperty = null;
        }
        else
        {
            directionIndex = orderBy.IndexOf(' ');

            // Direction.
            if (directionIndex &gt; -1)
            {
                orderBy = orderBy.Substring(0, directionIndex);
            }

            orderbyProperty = typeof(TEntity).GetProperty(orderBy);
        }

        if ((skippedResults != null) &amp;&amp; ((int)skippedResults &gt; 0) &amp;&amp; (orderbyProperty == null))
        {
            orderbyProperty = typeof(TEntity).GetProperty(GetPrimaryKeyName());
        }

        // Base EntitySet.
        ObjectQuery&lt;TEntity&gt; objectSetResults = Context.CreateObjectSet&lt;TEntity&gt;();
        var results = includes == null
            ? objectSetResults.AsQueryable()
            : includes.Aggregate(objectSetResults, (current, include) =&gt; current.Include(include.Trim())).AsQueryable();

        // Filter by Where Expression.
        if (whereExpression != null)
        {
            results = results.Where(whereExpression);
        }

        // Order Results.
        if (orderbyProperty != null)
        {
            results = directionIndex &gt; -1
                ? results.OrderByDescending(result =&gt; orderbyProperty.GetValue(result, null))
                : results.OrderBy(result =&gt; orderbyProperty.GetValue(result, null));
        }

        // Skip Records.
        if ((skippedResults != null) &amp;&amp; ((int)skippedResults &gt; 0))
        {
            results = results.Skip((int)skippedResults);
        }

        // Take Specific Amount of records.
        if ((totalResults != null) &amp;&amp; (totalResults &gt; 0))
        {
            results = results.Take((int)totalResults);
        }

        // Run the LINQ Query and return the results.
        return results;
    }