The closest post I can find for the issue I am having is https://www.ibm.com/developerworks/community/forums/html/topic?id=e44f2b21-c361-4cbf-a418-945fec03b8ea, but it has not solved my issue.
I am going to sum this up as best I can:
I have a statement that looks like this - return query.OrderBy(o => o.RegisterId).Take(maxRows).ToList();. While debugging, I can see .Take() is evaluating "maxRows" value as a constant. The first time a query is executed, the generated SQL contains the correct "maxRows" value. If I run the query again, after changing the "maxRows" value, I can see the constant is set to the new value; however, once .ToList() is called, it appears the previous expression tree is retrieved with the old "maxRows" value. The actual SQL that gets generated and sent to the database ends up looking like this:
FROM ... AS o
ORDER BY o.REGISTERID FETCH FIRST 3000 ROWS ONLY
The "FETCH FIRST 3000" is supposed to be parameterized like this: "WHERE o.REGISTERID = ", @__maxRows_0", but no matter how many times I change the "maxRows" value, the "FETCH FIRST 3000" constant is always used instead.
Can anyone give me insight into whether this is a bug in IBM.EntityFrameworkCore (126.96.36.199) & if there is a fix/workaround? This has become one of those issues that I have scoured the internet for days with absolutely no mention of anyone else seeing this problem. Thanks for anyone's time!