Last post May 05, 2014 01:15 PM by sjnaughton
May 04, 2014 02:20 PM|talldaniel|LINK
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?
May 04, 2014 02:47 PM|talldaniel|LINK
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.
May 05, 2014 01:15 PM|sjnaughton|LINK
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.
/// Fixes the sort by column issue with EF
/// see http://forums.asp.net/p/1528965/3811692.aspx#3811692
protected void GridDataSource_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
string s = e.SelectArguments.SortExpression;
e.SelectArguments.SortExpression = s.Substring(3);