

using(var ctx=new SchoolEntities())
{
ObjectQuery<Courses> courses = ctx.Courses;
IQueryable<Courses> allcourses = from c in courses
select c;
Console.WriteLine(courses.ToTraceString());
}


using(var ctx=new SchoolEntities())
{
ObjectQuery<Courses> courses = ctx.Courses;
IQueryable<Courses> allcourses = from c in courses
where c.CourseName == "Act"
select c;
}


using(var ctx=new SchoolEntities())
{
ObjectQuery<Courses> courses = ctx.Courses;
IQueryable<Courses> allcourses = from c in courses
orderby c.CourseType
select c.Skip(0).Take(100);
}
using(var ctx=new SchoolEntities())
{
var older = ctx.Persons.Max(p=>p.Age);
Console.WriteLine(older.Value);
}
5. Join{
var older = ctx.Persons.Max(p=>p.Age);
Console.WriteLine(older.Value);
}
using(var ctx=new SchoolEntities())
{
var query = from c in ctx.Courses
join d in ctx.CourseDetails
on d.CourseID equals c.CourseID
select new{
c, d.Info};
}
{
var query = from c in ctx.Courses
join d in ctx.CourseDetails
on d.CourseID equals c.CourseID
select new{
c, d.Info};
}