I'm using Simple.Data ORM. I'm trying to make a query from two joined tables. This query works fine:
dynamic alias;
var candidatesRec = db.dbo.Candidates
.FindAll(db.dbo.Candidates.CommonOfferId == commonOfferId
&& db.dbo.CandidateProfiles.CandidateId == null)
.LeftJoin(db.dbo.CandidateProfiles, out alias)
.On(db.dbo.Candidates.Id == alias.CandidateId)
.Select(
db.dbo.Candidates.Id,
db.dbo.Candidates.Email
)
.OrderByDescending(db.dbo.Candidates.ApplicationDate)
But when this line is added:
.Skip((pageNumber - 1) * pageSize)
I'm getting this exception:
The multi-part identifier \"dbo.CandidateProfiles.CandidateId\" could not be bound.
I was trying explicitly pass 0, 1 and few other numbers to Skip but I always get the same exception.
My test query should return 4 elements and I'm skipping 0 elements (it can be more in normal use).
Additional info: CandidateProfiles
has foreign key from Candidates
and it's CandidateId
can be null.
Edit: We've done a workaround for this problem, but I'm really curious why this one won't work. Simple.Data looked fun at first, but now I'm not sure if I will use it in future