Query data sources by using EF
LINQ-to-Entities
//Querying with LINQ to Entities
using (var context = new SchoolDBEntities())
{
var query = context.Students
.where(s => s.StudentName == "Bill")
.FirstOrDefault<Student>();
}using (var context = new SchoolDBEntities())
{
var query = from st in context.Students
where st.StudentName == "Bill"
select st;
var student = query.FirstOrDefault<Student>();
}Entity SQL
Native SQL
Last updated