TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Y G
NA
236
30.2k
Compiled queries in LINQ
Jul 25 2017 9:55 AM
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
Reply
Answers (
0
)
Given a collection of names, there may be a name 10 chars
linq query group by one column get multiple column