I am getting strange issue when I am calling a stored procedure like this using TemplateContext
string query = "exec SearchRequest @recct = @TotalCount OUTPUT" + parametersString.ToString();
var requestDtos = ctx.Database.SqlQuery<RequestDto>(query, totalCount).ToList();
This gets sometimes 30 and sometimes 60 objects in requestDtos
while the database is actually returning correct number of rows based on PageSize
parameter that I am passing to the stored procedure, but strangely records are getting duplicated while getting mapped to objects.
So instead of getting 10 objects if page size is 10 I am getting duplicated 30 or 60 objects.
Any idea of this strange behavior?