- using (TestAssessmentEntities context = new TestAssessmentEntities())
- {
- IQueryable result = MyCompliedQueries.cc(context, scheduleId);
- return result;
- }
-
-
- static class MyCompliedQueries
- {
- public static Func>
- cc = CompiledQuery.Compile>((context, scheduleId) => (from sch in context.Schedule
- where sch.Id == scheduleId && sch.ScheduleStatus == 2 && sch.DeliveryMode == 1
- join tes in context.Test on sch.TestId equals tes.Id
- join testsq in context.TestSectionQuestion on sch.TestId equals testsq.TestId
-
- select new QuestionPaper
- {
-
- NoOfQestions = tes.NoOfQuestions,
- MaxMarks = tes.MaxMarks,
- TestSectionList = (from schh in context.Schedule
- join testsec in context.TestSection on schh.TestId equals testsec.TestId
- select new TestSectionList
- {
- SectionName = context.TestSection.Where(x => x.TestId == schh.TestId).Select(x => x.Name).ToList(),
- Options = (from sc in context.Schedule
- join ques in context.Question on testsq.QuestionId equals ques.Id
- where ques.Id == testsq.QuestionId
- select new Options
- {
- QuestionText = context.Question.Where(x => x.Id == testsq.QuestionId).Select(x => x.QuestionText).ToList(),
- OptionText = context.QuestionOption.Where(x => x.QuestionId == ques.Id).Select(x => x.OptionText).ToList()
-
- }).FirstOrDefault()
- }).FirstOrDefault()
-
- })).FirstOrDefault());
- }
Displaying error as
can anyone please suggest me how to fix this issues related to compiled query