locked
get skip error when running auto generated code for Dynamic Data RRS feed

  • Question

  • User1457412228 posted

    I created a new project using the template DynamicData Application Entity in Visual Studio 2012.

    I added an entity framework connection to my database, "MyEntityMode" and I registered it in the autogenerated code in Global.asax and set scaffolding to true.

    It looks good on the first page when I run it, but when I click on any of the auto generated links that correspond to the table names, I get the error, "The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'."

    Since I am doing this in 2012 it initially crashed for another reason having to do with Object types, but I found the solution to that on a post that said to delete the .tt files and to change the codegenerationstrategy from none to "default".

    I did a search for Skip thinking to find it in the auto-generated code, but nothing looked like the culprit.  Anyone know the fix for this?

    Thanks

    Sunday, May 4, 2014 2:20 PM

Answers

  • User-330204900 posted

    it's not buggy at all sorry try adding this, not sure what your bug is but this was supposed to have been fixed in EF a whilse ago.

    /// <summary>
    /// Fixes the sort by column issue with EF
    /// see http://forums.asp.net/p/1528965/3811692.aspx#3811692
    /// </summary>
    protected void GridDataSource_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
    {
        string s = e.SelectArguments.SortExpression;
        if (s.StartsWith("it."))
            e.SelectArguments.SortExpression = s.Substring(3);
    }
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 5, 2014 1:15 PM

All replies

  • User1457412228 posted

    That turned out to be the paging set to true for the sqlconnection, setting paging to false allowed me to get to the next error.  When I tried to add a value to a table I got yet another error.  It appears this stuff is too buggy to actually use.  If someone else has done so successfully, please give me an idea of how many bugs you have to fix for the autogenerated code to run.

    Thanks!

    Sunday, May 4, 2014 2:47 PM
  • User-330204900 posted

    it's not buggy at all sorry try adding this, not sure what your bug is but this was supposed to have been fixed in EF a whilse ago.

    /// <summary>
    /// Fixes the sort by column issue with EF
    /// see http://forums.asp.net/p/1528965/3811692.aspx#3811692
    /// </summary>
    protected void GridDataSource_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
    {
        string s = e.SelectArguments.SortExpression;
        if (s.StartsWith("it."))
            e.SelectArguments.SortExpression = s.Substring(3);
    }
    
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 5, 2014 1:15 PM