Reputation: 829
I'm newer to Entity Framework (5.0). I'm using Linq Method syntax to Querying the data from database. I Want to see the Difference between Eager Loading and Lazy loading at the time of Query Execution.How can i see that in Visual Studio 2013.
Upvotes: 0
Views: 259
Reputation:
public async Task<ActionResult> Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
// Commenting out original code to show how to use a raw SQL query.
//Department department = await db.Departments.FindAsync(id);
// Create and execute raw SQL query.
string query = "SELECT * FROM Department WHERE DepartmentID = @p0";
Department department = await db.Departments.SqlQuery(query, id).SingleOrDefaultAsync();
if (department == null)
{
return HttpNotFound();
}
return View(department);
}
go to this link go thorugh this topic
Upvotes: 1