Hi!
I'm using v2.6 and I what I want to accomplish is the equivalent to the following query:
SELECT *
FROM Evaluation
INNER JOIN ExamType ON Evaluation.ExamTypeId = ExamType.ExamTypeId
INNER JOIN Student ON Evaluation.StudentId = Student.StudentId
INNER JOIN EvaluationTest ON Evaluation.EvaluationId = EvaluationTest.EvaluationId
INNER JOIN Test ON EvaluationTest.TestId = Test.TestId
INNER JOIN TestItem ON Test.TestId = TestItem.TestId
INNER JOIN Question ON TestItem.QuestionId = Question.QuestionId
INNER JOIN Plan_ExamType ON
Evaluation.PlanId = Plan_ExamType.PlanId AND
Evaluation.ExamTypeId = Plan_ExamType.ExamTypeId AND
I tried the following code:
IPrefetchPath2 pp = new PrefetchPath2((int) EntityType.EvaluationEntity)
{
EvaluationEntity.PrefetchPathExamType,
EvaluationEntity.PrefetchPathStudent
};
pp.Add(EvaluationEntity.PrefetchPathEvaluationTest).
SubPath.Add(EvaluationTestEntity.PrefetchPathTest).
SubPath.Add(TestEntity.PrefetchPathTestItem).
SubPath.Add(TestItemEntity.PrefetchPathQuestion);
pp.Add(EvaluationEntity.PrefetchPathPlan).
SubPath.Add(PlanEntity.PrefetchPathPlanExamType);
var evaluation = new EvaluationEntity(evaluationId);
ctx.Adapter.FetchEntity(evaluation, pp);
This would be perfect, but the problem seems to lie on the last inner join. I wan the Plan_ExamType to be joined to Evaluation by the 2 fields PlanId and ExamTypeId.
By fetching the PlanExamType through the PlanEntity prefetch It will only link through the PlanId field, thus retrieving unwanted records. Is there any way of forcing this kind of join (through two fields).
Thanks in advance.