var query = qf.ClassGroup
.Select(
ClassGroupFields.ID,
ClassGroupFields.Name,
ClassGroupFields.YearGroup,
ClassGroupFields.TeacherID,
ClassGroupFields.Teacher2ID,
ClassGroupFields.AssistantID,
ClassGroupFields.Assistant2ID,
ClassGroupFields.Email,
ClassGroupFields.IsFinesActive,
[b]qf.User[/b].CorrelatedOver(UserFields.ClassGroupID == ClassGroupFields.ID).CountRow().As(CountFieldName)
);
This is the query I want to run but the SQL generated uses "Borrower" rather than the "User" highlighted in bold). Borrower is a sub-type of User but the relation to ClassGroup is on User.
I also tried the CorrelatedOver overload that takes a relationship but get the same problem.
I have used this type of CorrelatedOver construct before without any problem..
var query = qf.Keyword
.OrderBy(KeywordFields.Phrase | SortOperator.Ascending)
.Select(
KeywordFields.ID,
KeywordFields.Phrase,
qf.ResourceToKeyword.CorrelatedOver(ResourceToKeywordFields.KeywordID == KeywordFields.ID).CountRow().As(CountFieldName)
);
the only difference being that this query has no inheritance on ResourceToKeyword.