Include before join Doesn't work Entity Framework 6

Viewed 1048

In an MVC4 project I use include in a LINQ query:

> var tests = from ct in context.CourseTest.Include("Test")  join uc in
> context.UserCourse on ct.CourseID equals uc.CourseID select ct;

CourseTest has a Test Object

This works inside the "using context"

but once returned to the controller using:

return tests.ToList();

the

UserCourse.Test is being disposed:

The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

This used to work fine in older version (not sure if I tested it with the join).

How can I make it stick.. ?

2 Answers
Related