IQueryable<CustomObject> obj = (from table in db.TableName
orderby table.ObjectId descending
select
new CustomObject
{
//Properties mapped here
}).Skip((pageNumber - 1) * pageSize).Take(pageSize);
The above is a stripped down version of the query I am running. It is missing about 10 joins and then just the bulk mapping of the object, which I have stripped out for confidentiality.
When run:
- pageNumber = 1
- pageSize = 500
table.ObjectId is a PK and so assumable to be unique
The query returns 500 objects into the IQueryable object, however instead of these 500 entries being unique I appear to get about 19 rows from the database duplicated across the 500 rows.
Is there an obvious reason as to why as I cannot find anything on Google regarding it.
Results in the object fit the following kind of pattern:
DBRow1
DBRow1
DBRow1
DBRow1
DBRow1
DBRow1
DBRow1
DBRow1
DBRow1
DBRow1
DBRow2
DBRow2
DBRow2
DBRow2
DBRow2
DBRow2
DBRow2
DBRow2
DBRow2
DBRow3
etc..