Subsequent count operations throws multipart identifier ... could not be bound
error
#287
Labels
under investigation
Issue is being analyzed
Waiting for Information
Waiting for additional information to replicate
Affected version:
1.7.0
(this works with1.6.3
).I'm able to demonstrate the issue, though I still don't fully get what's happening and why alias generation/mapping is not working anymore.
Consider the code (sligthly simplified):
This code is inside a
scoped
repository class and the response is used on the controller response to build the UI (Razor) including a paging mechanism. It's entirely on AspNet MVC Core (5.0
) and nothing should be stateful here.When I run this code for the first time I get a count query which is similar to:
However, on the second time we go to the same screen or if we refresh the page there, the cound SQL generated now looks like this:
As you can see, now all properties are prefixed with the automatic table alias (
y_1
) but not the table. This causes the notoriousmultipart identifier...
error.Somehow I managed to fix this by forcing a cleanup on the table mapping right before we start to build the count command here, as follows:
This seems to work at least on my case, but I can't guarantee it won't have side effects with others, mainly for more complex cases. Can you please advise on what I should look into, to better troubleshoot this?
The text was updated successfully, but these errors were encountered: