Try it. Instead:
var resultsQuery = ArticleServerContext.Database.SqlQuery<ArticleSummary>("GetFullTextSearchResults @SearchTerm, @SkipRows, @TakeRows", new SqlParameter("@SearchTerm", fullTextQuery), new SqlParameter("@SkipRows", pagination.SkippedRows), new SqlParameter("@TakeRows", pagination.RowsPerPage));
Using:
var results = ArticleServerContext.Database.SqlQuery<ArticleSummary>("GetFullTextSearchResults @SearchTerm, @SkipRows, @TakeRows", new SqlParameter("@SearchTerm", fullTextQuery), new SqlParameter("@SkipRows", pagination.SkippedRows), new SqlParameter("@TakeRows", pagination.RowsPerPage)).ToList();
Performance
Defferred Query is another reason I'm not an EF fan. By moving the ToList () call, you force EF to execute immediately . In updating your question, you are reporting that your problem is with the debugging issue of the IDE repeating your request twice (causing a duplicate parameter exception).
However, your debugging problem can be fixed by bypassing the Defferred Query Execution and forcing the execution to run immediately, thereby changing the contents of the resultsQuery variable from the query waiting to be called into the actual result set.
To be clear, moving the ToList () call causes the query to be immediately executed in your "resultsQuery" variable, which changes its contents (and because of this I changed the name of the variable to reflect its changed contents). Now the variable will contain the returned results of your query, not the query itself. Therefore, when you list it when execution is paused, you will list a static list of returned results, instead of repeating the query. Therefore, this will prevent the exception from being thrown.
This is why I stated in my comment that this problem never happened to me (except that I avoid EF now when possible).
You can learn more about MSDN here:
https://msdn.microsoft.com/en-us/library/bb738633%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396
In the above link, Microsoft states:
To force a query that does not create a singleton value, you can call the ToList method, the ToDictionary, or ToArray method on the query or query variable.